From 82f9b5c81896cbd62c84df89df839c497a3e2ebc Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Tue, 15 Feb 2011 07:47:48 +0000 Subject: Win! Got some very basic grabbing and moving implemented. Found the Node object's amazing get/setUserData method. I had a brillant hunch such a method may exist. The mouse movements need to be scaled to the vworld coordinates though. --- src/tesseract/World.java | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'src/tesseract/World.java') diff --git a/src/tesseract/World.java b/src/tesseract/World.java index 9b43b87..e898a27 100644 --- a/src/tesseract/World.java +++ b/src/tesseract/World.java @@ -37,12 +37,7 @@ public class World { * Root element of the world. */ private BranchGroup myScene; - - /** - * Pickable Objects. - */ - private BranchGroup myPickableObjects; - + /** * Bounding box of the world. */ @@ -97,11 +92,6 @@ public class World { myScene.addChild(createVirtualWorldBoundsShape()); - myPickableObjects = new BranchGroup(); - myPickableObjects.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); - myPickableObjects.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); - //myScene.addChild(myPickableObjects); - addLights(); addHalfspaces(); @@ -237,34 +227,13 @@ public class World { return myScene; } - /** - * Setup mouse behaviors in the world. - * - * @param canvas The canvas to tie the events to. - */ - public void setupMouseBehaviors(final Canvas3D canvas) { - //BranchGroup pickables = new BranchGroup(); - myPickableObjects.addChild(new PickTranslateBehavior(myPickableObjects, canvas, myVirtualWorldBounds, PickTool.GEOMETRY)); - myPickableObjects.addChild(new PickZoomBehavior(myPickableObjects, canvas, myVirtualWorldBounds, PickTool.GEOMETRY)); - myScene.addChild(myPickableObjects); - - /*myPickableObjects.addChild( - new PickTranslateBehavior(myPickableObjects, canvas, - myVirtualWorldBounds, PickTool.GEOMETRY)); - - myPickableObjects.addChild( - new PickZoomBehavior(myPickableObjects, canvas, - myVirtualWorldBounds, PickTool.GEOMETRY)); - */ - } - /** * Add a new object to the world. * * @param obj The object to add */ public void addObject(final PhysicalObject obj) { - myPickableObjects.addChild(obj.getGroup()); + myScene.addChild(obj.getGroup()); myObjects.add(obj); } -- cgit v1.2.3