Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 1026 times)
0 Members and 1 Guest are viewing this topic.
Offline Weastmann

Junior Newbie





« Posted 2005-09-09 16: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 07: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 07: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!
Legends of Yore - The Casual Retro Roguelike
Offline Breakfast

Senior Member




for great justice!


« Reply #3 - Posted 2005-09-13 14: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 15: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 05: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 16: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.

 

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

The first screenshot will be displayed as a thumbnail.

UprightPath (17 views)
2014-09-20 20:14:06

BurntPizza (26 views)
2014-09-19 03:14:18

Dwinin (40 views)
2014-09-12 09:08:26

Norakomi (70 views)
2014-09-10 13:57:51

TehJavaDev (95 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56

mitcheeb (70 views)
2014-09-08 06:06:29

BurntPizza (52 views)
2014-09-07 01:13:42

Longarmx (39 views)
2014-09-07 01:12:14

Longarmx (45 views)
2014-09-07 01:11:22
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!