/** * Instantiate an enabled control to visualize the specified vehicle. * * @param debugAppState which app state (not null, alias created) * @param body which vehicle to visualize (not null, alias created) */ public BulletVehicleDebugControl(BulletDebugAppState debugAppState, PhysicsVehicle body) { super(debugAppState); this.body = body; suspensionNode = new Node("Suspension"); createVehicle(); }
public Node getRootNode() { if (rootNode == null) { rootNode = new Node("ZoomLevel"); if (parent != null) { rootNode.setLocalScale(1.0f / poiRadius); } } return rootNode; }
private void parseNode(Attributes attribs) throws SAXException { String name = attribs.getValue("name"); if (name == null) { name = "OgreNode-" + (++nodeIdx); } com.jme3.scene.Node newNode = new com.jme3.scene.Node(name); if (node != null) { node.attachChild(newNode); } node = newNode; }
/** * Instantiate an enabled control to visualize the specified vehicle. * * @param debugAppState which app state (not null, alias created) * @param body which vehicle to visualize (not null, alias created) */ public BulletVehicleDebugControl(BulletDebugAppState debugAppState, PhysicsVehicle body) { super(debugAppState); this.body = body; suspensionNode = new Node("Suspension"); createVehicle(); }
@Override public void simpleInitApp() { inBetweenNode = new Node("In Between Node"); rootNode.attachChild(inBetweenNode); flyCam.setDragToRotate(true); } }
/** * creates an empty node with a RigidBodyControl * * @param manager for loading assets * @param shape a shape for the collision object * @param mass a mass for rigid body * @return a new Node */ public static Node createPhysicsTestNode(AssetManager manager, CollisionShape shape, float mass) { Node node = new Node("PhysicsNode"); RigidBodyControl control = new RigidBodyControl(shape, mass); node.addControl(control); return node; }
@Override public void initialize(AppStateManager stateManager, Application app) { if (rootNode == null) { rootNode = new Node("Root Node"); } if (viewPort == null) { viewPort = app.getViewPort(); } viewPort.attachScene(rootNode); super.initialize(stateManager, app); }
private Node createLimb(float width, float height, Vector3f location, boolean rotate) { int axis = rotate ? PhysicsSpace.AXIS_X : PhysicsSpace.AXIS_Y; CapsuleCollisionShape shape = new CapsuleCollisionShape(width, height, axis); Node node = new Node("Limb"); RigidBodyControl rigidBodyControl = new RigidBodyControl(shape, 1); node.setLocalTranslation(location); node.addControl(rigidBodyControl); return node; }
@Test public void testIssue954() { rootNode = new Node(); rootNode.updateLogicalState(0.01f); rootNode.updateGeometricState(); assert rootNode.worldBound != null; } }
private void initGhostObject() { Vector3f halfExtents = new Vector3f(3, 4.2f, 1); ghostControl = new GhostControl(new BoxCollisionShape(halfExtents)); Node node=new Node("Ghost Object"); node.addControl(ghostControl); rootNode.attachChild(node); getPhysicsSpace().add(ghostControl); }
Node createTestNode(float mass, Vector3f location) { float size = 0.1f; Vector3f halfExtents = new Vector3f(size, size, size); CollisionShape shape = new BoxCollisionShape(halfExtents); RigidBodyControl control = new RigidBodyControl(shape, mass); Node node = new Node(); node.addControl(control); rootNode.attachChild(node); bulletAppState.getPhysicsSpace().add(node); control.setPhysicsLocation(location); return node; }
@Override protected void initialize(Application app) { debugNode = new Node("Environment debug Node"); Sphere s = new Sphere(16, 16, 0.15f); debugGeom = new Geometry("debugEnvProbe", s); debugMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/reflect.j3md"); debugGeom.setMaterial(debugMaterial); debugBounds = BoundingSphereDebug.createDebugSphere(app.getAssetManager()); if (scene == null) { scene = app.getViewPort().getScenes().get(0); } }
@Override public void initialize(AppStateManager stateManager, Application app) { super.initialize(stateManager, app); this.inputManager = app.getInputManager(); target = new Node("ChaseCamTarget"); camNode.setCamera(app.getCamera()); camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera); target.attachChild(camNode); camNode.setLocalTranslation(0, 0, distance); upVector = app.getCamera().getUp().clone(); leftVector = app.getCamera().getLeft().clone(); registerWithInput(); rotateCamera(); }
@Override public void simpleInitApp() { flyCam.setEnabled(false); initMark(); // a red sphere to mark the hit /** create four colored boxes and a floor to shoot at: */ shootables = new Node("Shootables"); rootNode.attachChild(shootables); shootables.attachChild(makeCube("a Dragon", -2f, 0f, 1f)); shootables.attachChild(makeCube("a tin can", 1f, -2f, 0f)); shootables.attachChild(makeCube("the Sheriff", 0f, 1f, -2f)); shootables.attachChild(makeCube("the Deputy", 1f, 0f, -4f)); shootables.attachChild(makeFloor()); shootables.attachChild(makeCharacter()); }
@Test public void testOverrides_AddAfterAttach() { Node scene = createDummyScene(); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); root.attachChild(scene); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); validateScene(root); }
@Test public void testOverrides_AddBeforeAttach() { Node scene = createDummyScene(); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); root.attachChild(scene); validateScene(root); }
@Test public void testPhantomTriangles() { assetManager = new DesktopAssetManager(); assetManager.registerLocator(null, ClasspathLocator.class); assetManager.registerLoader(J3MLoader.class, "j3m", "j3md"); rootNode = new Node(); createRedSquare(); createWhiteLines(); rootNode.updateLogicalState(0.01f); rootNode.updateGeometricState(); castRay(); } }
@Test public void testOverrides_RemoveAfterAttach() { Node scene = createDummyScene(); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); root.attachChild(scene); validateScene(root); scene.getChild("A").clearMatParamOverrides(); validateScene(root); }
@Test public void testOverrides_RemoveBeforeAttach() { Node scene = createDummyScene(); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); validateScene(scene); scene.getChild("A").clearMatParamOverrides(); validateScene(scene); root.attachChild(scene); validateScene(root); }
@Test public void testOverrides_Empty() { Node n = new Node("Node"); assertTrue(n.getLocalMatParamOverrides().isEmpty()); assertTrue(n.getWorldMatParamOverrides().isEmpty()); n.updateGeometricState(); assertTrue(n.getLocalMatParamOverrides().isEmpty()); assertTrue(n.getWorldMatParamOverrides().isEmpty()); }