I would use in both cases a behavior which uses a
WakeupOnElapsedTime as wakeup criteria.
The
simplest thing, in my opinion, is to use the switch, so that the behavior has
nothing more to do than to turn on one bit in the switch mask. You add all the
objects to animate to the switch and set the switch mask to 0 - nothing
displayed. Add the switch to the main branch group. Create the behavior giving
the switch and add also the behavior to the main branch group. Inside the
processStimulus method of the behavior keep a counter for the
next bit to be set in the mask every time the behavior is invoked, which gets
incremented. That should be all.
Cheers,
Florin
-----Urspr�ngliche Nachricht-----Hi Florin,
Von: A. Murat Tanyer [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 10. M�rz 2003 12:24
An: [EMAIL PROTECTED]
Betreff: Re: [JAVA3D] add Shape3Ds as a function of time!!!
Thanks for your reply. Can you give me examples of how to use these two ways. There is a class called "javax.swing.Timer". Should I use this class to specify my adding time?
Florin Herinean wrote:
I know of two ways (there might be others):1. really add the objects using BranchGroups at different times.2. add all the objects at one time and use a Switch to turn them visible one by one, the switch being controled by the timer loop - a behavior maybe ?It's up to you to choose which one of those suits you best.Cheers,Florin-----Urspr�ngliche Nachricht-----Dear members,
Von: A. Murat Tanyer [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 10. M�rz 2003 11:21
An: [EMAIL PROTECTED]
Betreff: [JAVA3D] add Shape3Ds as a function of time!!!
I want to add Java3D objects to the scenegraph during the runtime. I know that there is a way to add objects by the help of the BranchGroup.
I am trying to make an animation. So in my case, I want to add Shape3Ds as a function of time.I have a loop and at the end of each loop I have a bunch of Shape3Ds and their adding time (or delay time according to the first bunch) to the scenegraph. My animation (this loop) starts when the user presses a JButton in the GUI.
For example, I want to add ObjectBunch_1 at time "t", ObjectBunch_2 at time "t + 2 sec", ObjectBunch_3 at time "t + 4 sec", etc.
What is the best way to solve this problem?
Thanks for any help.
