Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to move an 3DObject after it has been added to the SimpleUniverse  (Read 807 times)
0 Members and 1 Guest are viewing this topic.
Offline Weastmann

Junior Newbie





« Posted 2005-09-09 18:14:09 »

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
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-09-12 09:48:04 »

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.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Weastmann

Junior Newbie





« Reply #2 - Posted 2005-09-13 09:27:44 »

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
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Breakfast

Senior Member




for great justice!


« Reply #3 - Posted 2005-09-13 16:26:28 »

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

Junior Newbie





« Reply #4 - Posted 2005-09-13 17:36:32 »

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
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2005-09-16 07:49:09 »

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

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.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Breakfast

Senior Member




for great justice!


« Reply #6 - Posted 2005-09-16 18:35:29 »

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.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (97 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.077 seconds with 21 queries.