private void addObjects() { final Box box1 = new Box("box", Vector3.ZERO, 5, 15, 5); box1.setTranslation(0, box1.getYExtent(), 0); TextureState ts = new TextureState(); ts.setTexture( TextureManager.load("images/skybox/1.jpg", Texture.MinificationFilter.Trilinear, true)); box1.setRenderState(ts); box1.getSceneHints().setPickingHint(PickingHint.Pickable, true); box1.setModelBound(new BoundingBox()); final Node base = new Node(); base.setTranslation(0, 0, 0); base.attachChild(box1); _root.attachChild(base); final Sphere sphere = new Sphere("sphere", Vector3.ZERO, 16, 16, 8); ts = new TextureState(); ts.setTexture( TextureManager.load( "images/water/dudvmap.png", Texture.MinificationFilter.Trilinear, true)); sphere.setRenderState(ts); sphere.getSceneHints().setPickingHint(PickingHint.Pickable, true); sphere.setModelBound(new BoundingSphere()); final Node joint = new Node(); joint.setTranslation(0, sphere.getRadius() + 2 * box1.getYExtent(), 0); joint.attachChild(sphere); base.attachChild(joint); final Box box2 = new Box("box", Vector3.ZERO, 5, 15, 5); box2.setTranslation(0, box2.getYExtent(), 0); ts = new TextureState(); ts.setTexture( TextureManager.load("images/skybox/3.jpg", Texture.MinificationFilter.Trilinear, true)); box2.setRenderState(ts); box2.getSceneHints().setPickingHint(PickingHint.Pickable, true); box2.setModelBound(new BoundingBox()); final Node arm = new Node(); arm.setTranslation(0, sphere.getRadius(), 0); arm.attachChild(box2); joint.attachChild(arm); // auto select the joint _root.updateGeometricState(0); manager.setSpatialTarget(joint); }
private void addFloor() { final Box floor = new Box("floor", Vector3.ZERO, 100, 5, 100); floor.setTranslation(0, -5, 0); final TextureState ts = new TextureState(); ts.setTexture( TextureManager.load("models/obj/pitcher.jpg", Texture.MinificationFilter.Trilinear, true)); floor.setRenderState(ts); floor.getSceneHints().setPickingHint(PickingHint.Pickable, false); floor.setModelBound(new BoundingBox()); _root.attachChild(floor); }