Im in this situation, I have an ADF with some 3D object on it (I have the positions of objects saved on DB), now what Im doing is loading ADF,waitting to LOCALIZE and putting 3D objects on it but every time I run the app object appears in different places and I noticed that this depends on the orientation/pose of smartphone when it starts, so in few words how to take in account device pose/orientation and put 3D object in Rajawali3D(graphic engine) with respect to that pose?
Under Unity I had the same problem, I fixed it by checking the "Use Area description" in the Tango Pose Controller prefab. What this does, is that it changes the Frame of reference that Tango is using to localize itself: indeed instead of TANGO_START_OF_SERVICE you need to use TANGO_AREA_DESCRIPTION as a base reference frame.
Related
I am working on converting some of my games to android after already publishing them to the IOS App store. I wanted to add a little motion to the objects on the screen. In Spritekit, you can simply use the following to move a node a certain length:
Node.run(SKAction.move(by: CGVector(x,y), duration: time))
This is very useful for giving motion to stuff on the screen and wanted to replicate it in Java. Does anyone know how this can be done?
Unfortunately, it is not that easy to move objects in Android.
There is some difference in iOS and Android, where iOS provides easy to use framework, Android doesn't have any easy to use native framework.
Now how to do it, in Android?
First let's learn some basics:-
iOS has SpriteKit, Android has Canvas
SpriteKit can use concept of Node to display object on screen.
Canvas uses bitmaps to draw objects on screen.
Now, it is too big of a topic to cover on Stackoverflow, but the general things, we need to do is:-
Draw objects on screen, where they should have been initially
Then we have to setup game environment is such a way, that the game runs in a while loop, and which should atleast give user, 60 FPS.
Then add the move object logic, inside the while loop. Thus, giving the user, the illusion that the object moved (2, 6) position in 10 seconds.
I would literally just show you the code, which does that https://bitbucket.org/jenelleteaches/android2d-pongclone/src/master/MainActivity.java
And would recommend reading this book, before moving into 2d game development in Andorid :- Android Game Programming by Example. This is published by Packt
I am writing an AR Android application in which I scan QR codes (using the Google Mobile Vision Barcode API) as a trigger and then render objects into the camera view.
As there may be more than one QR code at the same time, I want to access the location of each code on the screen, so that the objects will be rendered on top of each code. At the moment - if there are two QR codes being detected by the camera - the objects will be placed at the exact same position in 3D space.
Example:
There are two QR codes being detected by the camera, one on the left
and one on the right of my camera view. Right now, both objects would
be rendered in the center of my camera view, as this is the default
value of my app.
I want the object related with the left code to
appear on the left and the object related with the right code to
appear on the right.
I have tried calling Barcode.getBoundingBox().exactCenterX() and [...].exactCenterY() to get a rough value of the code's location, but it does not work out well. Unfortunately I can't find a more suitable method in the documentation.
I can't be the only one who needs the code's location on the screen. How did you guys do that?
Thanks a lot.
i am new to java 3d. i have encountered a situation like , i want to load ready made developed 3d model of any object [as an example shoe] developed in 3d modeling software like 3d studio max or Maya in my java program , update its texture or color properties etc. then render it and then display the updated model to the end user.
so i am asking all the 3d experts how should i proceed ahead to accomplish my goal ?
which input should i load into my program ?
how can i update the loaded model , render it and display the updated model to the end user ?
in simple story , i want to give my users ability to modify 3d model by their interactions as such ,
they provided 3d model of shoe for example in default colors and textures & some fields like sole color , if they choose color red then the loaded 3d model's sole is colored red (i.e. updated) and then displayed to end user with red color rubber sole shoe instead of default color shoe.
please, advice me to accomplish my goal.
Ok so first of all, complex objects are usually created using some 3D editing software like Blender or Art of Illusion. These programs can output the object into several different file formats, the most common being the .obj file format:
http://en.wikipedia.org/wiki/Wavefront_.obj_file
Another common format is .3ds, which in my experience is a lot more work than it's worth. They do make a .3ds file loader for Java3D, the page can be found here:
http://www.starfireresearch.com/services/java3d/inspector3ds.html
My advice for you is to just use the .obj file format, it is a lot easier to use. You can also just make your own parser for it which is not as hard as it sounds. This way you know exactly how your object is being loaded into the environment. Java does come with it's own parser, instructions on how to use it are here:
http://www.vrupl.evl.uic.edu/LabAccidents/java3d/lesson08/indexa.html
I have had a lot of trouble with files exported with Blender while using this file format unfortunately, they may have fixed the problem by now but I'm not sure. When I used to do a lot more 3D stuff I just used Art of Illusion, even know Blender is a lot more powerful. Blender can be run on a Mac but is a lot smoother on windows with the proper setup. Good luck! If you need some example code let me know and I would be more than happy to post some for you.
Art of Illusion:
http://www.artofillusion.org
http://www.artofillusion.org/documentation#
Blender:
http://www.blender.org
http://www.blender.org/education-help/tutorials/
Im not sure how you want the user to be able to change the object. If you want them to be able to change the color, or the type of shoe or whatnot that is not a huge deal. If you want the user to be able to change the lace length or something where you are changing the actual object's structure, that requires an in depth knowledge of 3D structure. If you want to change a color, just change the material. If you want to be able to change the type of shoe, just load a different shoe object. I hope this was helpful for you.
In the comments, you also talk about texture mapping, which in my experience is a lot easier to do in Blender than it is to do in Art of Illusion. I would probably use blender to accomplish this:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV
John
I assume you just want the user to select a different texture/color, right?
Then have a look at the Java3D tutorials out there, e.g. this one: http://www.java3d.org/tutorial.html
I further guess your shoe is actually a 2-part model, i.e. just the sole should get another color while the rest might get a different texture, right?
In that case, you'd need 2 models/shapes, each with its own appearance. Then, for example, alter the soles appearance as you like, e.g. by assigning a different material or changing the material's color.
I'm developing a system in Java 3D, which consists of a main window where I have an object that I can manipulate (rotate, translate), and I have 3 other smaller windows that show different views from this same object, but can't directly manipulate the object.
The next thing I want to do is to reflect the actions I make in the main window to the other windows, in real time.
Does anyone have any idea of how I can proceed in order to do this?
You should define cameras fo the other windows in a fixed position, and render the object with the same world matrix, but with the different camera's view and projection. Probablyyou already have a code to render the object, you only need to use different cameras for that.
Without any code it is the most precise answer, I believe.
I am developing a small desktop application in Netbeans. The application is complete and working fine. A small description of application is as follow:
The application is basically an object manager, where user add new object, remove old objects and connect object with each other. What i did is that i simply add 3 panel and change its type to titled border. One for Add object one for remove and one for connect.
Status:
Every thing is working fine as expected.
What Left:
In order to make UI more appealing i added a new panel at the end and called it "Object Viewer". I am planing to visualize the steps which user performs e.g
If user add an object then i that pannel i will daraw a little
circle and fill it with green color
Similarly if user remove some object then again i will draw another
cricle and fill that with red
And when user connects two object then i will draw two circle and
connect them with a dotted line
This is my first java application, i only want to know how do i acheive this task. Some links or experience are highly appreciated
As for custom painting in swing, have a look here: http://download.oracle.com/javase/tutorial/uiswing/painting/
However, I'd suggest using a graph visualization library like JUNG etc. Using this you'd basically only have to define your object graph.
You can either do that manually with Java 2D, which I don't recommend, or, since you are using Netbeans (and I assume the Netbeans Platform, but this is not required), I would strongly suggest looking at the Netbeans Visual Library. It can do exactly what you want.
As Nico Huysamen said you can do that with Java 2D. But because it's your first Java application I strongly recommend to do it manually with this lybrary in order to understand how higer level lybraries work.