How to move an 3DObject after it has been added to the SimpleUniverse

Hi, i’m new to this Java3D stuff, and I was just wondering about something.

So far i can place a rotating colored square into a SimpleUniverse, but my question is how do i set its velocity after I’ve added it?

Perhaps i don’t know enough of Java3D to explain this correctly, so sorry about that

Thanks,
Weastmann

You move objects by setting transform matrices in the tree above them.

If that doesnt make sense to you your going to have a LOT of trouble with 3D because its all based on vectors and transform matrices.

Great thanks, so does this translation matrice only set the objects position, or can it be used to as a vector matrice?

Say we have this point:
(100,50)
How do I get the object to move from its origin to the point (100,50) with a speed of about 20 ms-1. If you could show me an example of how this would be done, that would be cool.

Thanks,
Weastmann

A long time ago, in a galaxy far away, I wrote a tutorial that you may find useful.

hey, i rember this tutorial from a while ago, but i had a problem when using it. For some reason during the “WalkDude” application, the purple guy always flies of the screen even if i just tap the forward key.

Is there a way to fix this?

Thanks,
Weastmann

The transform tree of the scene graph describes the static position of everything at the scene at one point in time.

If you arent writing a game and can use “sloppy motion” where you cant count on wher it isin any given frame, you cna use Java 3D’s interpolators to interpolate a transform matrix between to values over time.

If youa re doing a game or some other kind pof program that requires rpecise control of motion then you need to write animation code that is called from a WakeupOnFrame(0) behavior to do the animation.

If you’ld like to see an example, you can grab my code for JNWN at jnwn.dev.java.net. Look at AnimationBehavior and how it works. I warn you its moderately complex because it handles a variety of animation manipulations, not just motions.

Sounds like your framerate is faster than the original code expected - this is quite likely given that I wrote it 2-3 years ago now. Try reducing the the size of the forward step by a factor of 100 or so. There was also a problem with some processors and the J3D high res timer, I seem to recall I have found a workaround for this.

The questions you are asking are largely answered in that tutorial- if you follow through the text you should be able to work out why it’s not working on your machine and fix it from the source code.