Hi,
I have a problem. I have 2 virtual universes on 2 separate Canvas3D objects side by
side in 1 application window. I can access the canvases and scenegraph objects by
calling brainCanvas[0], objRoot[0] etc.
I want the two objects on the 2 seperate virtual universes to rotate at the same time,
when I try to rotate only 1 of them. Is there a way of doing this? I tried to add a
box to the second universe when the mouse was dragged in the first but it didn't work.
I have attached the behavior class and error message I recieved.
Thanks in advance
Mouse Dragged
Exception occurred during Behavior execution:
javax.media.j3d.RestrictedAccessException: Group: only a BranchGroup node may be added
at javax.media.j3d.Group.addChild(Group.java:260)
at TransformationBehavior.processEvents(TransformationBehavior.java:71)
at TransformationBehavior.processStimulus(TransformationBehavior.java:51)
at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
at javax.media.j3d.J3dThread.run(J3dThread.java:250)
*__________________________________________________________________________
import javax.media.j3d.*;
import java.util.*;
import java.awt.Event;
import java.awt.Point;
import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import com.sun.j3d.utils.behaviors.mouse.*;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.vecmath.*;
public class TransformationBehavior extends Behavior
{
BranchGroup SecRoot;
MouseRotate mr;
WakeupCondition condition = new WakeupOnAWTEvent MouseEvent.MOUSE_DRAGGED);
public TransformationBehavior(BranchGroup objRoot, MouseRotate mr)
{
SecRoot =objRoot;
this.mr = mr;
}
//initialise criterion
public void initialize()
{
wakeupOn(condition);
}
public void processStimulus(Enumeration criteria)
{
while(criteria.hasMoreElements())
{
condition = (WakeupCriterion)criteria.nextElement();
if(condition instanceof WakeupOnAWTEvent)
{
AWTEvent[] evt = ((WakeupOnAWTEvent)condition).getAWTEvent();
for(int i = 0;i<evt.length;i++)
{
if(evt[i] instanceof MouseEvent)
{
MouseEvent mouseEvt = (MouseEvent)evt[i];
processEvents();
}
}
}
}
}
public void processEvents()
{
BoundingSphere bounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100000.0);
System.out.println("Mouse Dragged");
//MouseRotate mr1 = new MouseRotate();
//mr1.setupCallback(this);
//mr1.setTransformGroup(SecTransform);
//mr1.setSchedulingBounds(bounds);
//mr1.setFactor(0.007);
SecRoot.addChild(mr);
}
}
__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.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".