Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  need some animation advice  (Read 712 times)
0 Members and 1 Guest are viewing this topic.
Offline bennythemink

Innocent Bystander





« Posted 2005-07-23 14:13:59 »

hi,

im making a crowd simulatior in java3d. the basic idea is the user drags and drops people and obstacles onto a 2d map and then hits run. then using this info a java3d representation will appear showing the people moving around avoiding each other and the obstacles.

what happens is that at each time step each person object is sent to a behaviour object (e.g. a separation or a collision avoidance behaviour) and a vector3d is calculated and applied to the person object. this then updates the java3d rep.

i need help as i dont know how to update the java3d representation at each time step and what unit of time to use as i dont think System.currentTime Millis is the right way to go about it?

ive attached my class diagram in case anyones interested. im still only at the design stage so any advice now would be a big help:)
many thanks.
Offline Breakfast

Senior Member




for great justice!


« Reply #1 - Posted 2005-07-26 22:13:36 »

If you were working in 2D you might be able to call "render" every few milliseconds to keep updating the view but that isn't really how java3d works.

What Java3D does is to update the scene as often as it possibly can- it is constantly updating it. You change things in the scene using behaviours and usually you do it regardless of what java3d is doing at the time. You can use a behaviour that tells you every time that a frame is rendered but you have to be careful because on different hardware you will potentially get very different results.

It's quite conceptually tricky to get started with but once you get your head round the way it works it's reasonably easy to use.
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2005-07-29 23:40:34 »

The magic of frame by frame update is using the WakeOnFrame(0) wakeup conditio nfor the beahvior.

This ensurs that the behavior will be woken once per frame and only once per frame.

Using behavior priority groups you can specify the order in which all your WakeOnFrame(0) behaviors are executed.

HOWEVER its important to realize that changes applied to transforms dont effect things like bouding volumes right away.  Thats not calculated til the behaviors all all done.  So you may get odd effects if you try to read those thinsg back and use them in your logic.

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
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.

Riven (6 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (21 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!