Just throwing in MHO... some opinions about making simulations that I didn't
find, and since learned, after I started Java3D not too long ago.
I'm pretty much a novice with Java3D but I'm making some good progress with
simulation stuff (more of the particle system & physics based animation
type). At first I tried using the scene graph and behaviours, but that soon
became very complex (and too much code and I'm lazy). Then I tried "mixed
immediate mode" rendering and everything clicked.
The thing is, I had a good idea about how to program my simulation, that is
the physical model and calculations to control it, but I didn't have the 3D
visualization. I wanted to add the 3D "separately". That's how I'd usually
go about making stuff anyway; design/make the logical, process stuff first,
get that working, and wrap the visual stuff around it -- a
Model-View-Controller design more or less.
It seems to me that the Java3D scene graph and interpolators/behaviours is
just the ticket if you're making an interactive animated presentation. In
that case the scene and objects and behaviours IS the simulation. But if you
are simulating some kind of process, where you have the model in mind or
designed already, then Java3D can also be used as a view into that
simulation model. The nice Java3D guys gave us immediate mode rendering too,
I guess for this reason.
The "mixed" immediate mode rendering would let you do both, using the
regular scene graph for static (and simple behaviour) parts of the scene
(walls, floor, background, conveyor and belt) then immediate mode can draw
in some boxes on the conveyor belt in positions that your simulation model
will know they should be at any given time (start-position + sim-time *
belt-speed etc.). No adding/removing from the scene graph is needed at all.
Use Java3D's rendering loop to update the simulation by whatever time passed
since the last rendered frame. In your case something sort of like:
class MySimCanvas3D extends Canvas3D {
/** Time (ms) of start of simulation. */
long t0;
/** Draw in this context. */
GraphicsContext3D gc;
public MySimCanvas3D() {
super(SimpleUniverse.getPreferredConfiguration());
t0 = System.currentTimeMillis();
gc = getGraphicsContext3D();
}
/** Overides Canvas3D's method to render sim stuff in mixed immediate
mode. */
public void renderField(int fieldDesc) {
// update your sim to current time ...
// put boxes on belt
gc.setModelTransform( a-transform-of-a-box );
// draw boxes
gc.draw( a-conveyor-box-shape );
}
}
Cheers,
John
----- Original Message -----
From: "Mark Beckman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 04, 2000 1:45 PM
Subject: [JAVA3D] Java 3D for simulation
> Hi Folks,
>
> My client has asked me to build a simulator for their
> conveying system using the Java 3D API. Here are some
> questions that I have regarding this effort.
>
> (1) Has anyone out there used Java 3D to model and
> give behavior to a conveyor belt system (or similar
> transport device)?
>
> (2) Given a section of the conveyor system, how would
> you add and eventually remove an object (e.g. a box)?
> In otherwords, can I add/remove an element to/from a
> scene-graph during runtime??? Or is there a better
> approach???
>
> I am new to the Java 3D API. I would like to speak
> with anyone who as been involved with the creation of
> simulators using the API.
>
> Thank You,
>
> Mark Beckman
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".