David,

One option is to move the behavior out of the switch. Put it at the same
level as the switch so that it continually runs even if the switch is turned
off.

Another option is to just change the rendering attributes for the car to set
it invisible. You can probably do this using the alternate appearance
support in J3D or just modify the original appearances rendering attributes.

Hope that helps,
-mike


-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]
On Behalf Of David Barber
Sent: Friday, October 22, 2004 12:27 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Rendering switch

Hi

I currently have an application that animates cubes based on paths defined
by an external file.  The file has around 15 minutes worth of paths, but
each object (representing cars) only exist for 15 - 30 seconds within that
period.  Each car has its own RotPathInterporlator and its own Alpha (which
have different phase delays depending on when the car is supposed to start
moving and how long the car exists).

It works, but all of the cars are added to the scene graph at once, so they
are all rendered (even if they don't exist in time yet).  I've tried to
solve this by adding a switch to each object (initially setting CHILD_ALL
as the value) and then setting up a custom behaviour to check the values of
the appropriate alpha object every X frames.  If  alpha > 0 & < 1 then the
behaviour sets the switch to CHILD_ALL, if not it sets it to CHILD_NONE.

This works (all cars appear at the start and then disappear after x frames
if their Alpha object value = 0) but the switch doesn't set back to
CHILD_ALL when their alpha object value is between 0 &  1.  The switch only
works once?  Once the switch is turned 'off' does that mean it won't have
the behavior act on it?

Each 'car' looks like this:

objSwitch -> objTG
objSwitch -> ObjMyCustomSwitchBehavior
objTG -> ObjRotPosInt
objTG -> ColorCube

ObjMyCustomSwitchBehavior is targeted at ObjSwitch but is initialised with
the Alpha object for each car.
ObjRotPosInt is targeted at the objTG (transform group).

Any suggestions to solve this - or a better way?

TIA

David

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

Reply via email to