/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { body.getBodyA().getPhysicsLocation(a.getTranslation()); body.getBodyA().getPhysicsRotation(a.getRotation()); body.getBodyB().getPhysicsLocation(b.getTranslation()); body.getBodyB().getPhysicsRotation(b.getRotation()); geomA.setLocalTransform(a); geomB.setLocalTransform(b); arrowA.setArrowExtent(body.getPivotA()); arrowB.setArrowExtent(body.getPivotB()); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { body.getBodyA().getPhysicsLocation(a.getTranslation()); body.getBodyA().getPhysicsRotation(a.getRotation()); body.getBodyB().getPhysicsLocation(b.getTranslation()); body.getBodyB().getPhysicsRotation(b.getRotation()); geomA.setLocalTransform(a); geomB.setLocalTransform(b); arrowA.setArrowExtent(body.getPivotA()); arrowB.setArrowExtent(body.getPivotB()); }
@Override protected Spatial getDebugShape() { //add joints Spatial shape = super.getDebugShape(); Node node = null; if (shape instanceof Node) { node = (Node) shape; } else { node = new Node("DebugShapeNode"); node.attachChild(shape); } int i = 0; for (Iterator<PhysicsJoint> it = joints.iterator(); it.hasNext();) { PhysicsJoint physicsJoint = it.next(); Vector3f pivot = null; if (physicsJoint.getBodyA() == this) { pivot = physicsJoint.getPivotA(); } else { pivot = physicsJoint.getPivotB(); } Arrow arrow = new Arrow(pivot); Geometry geom = new Geometry("DebugBone" + i, arrow); geom.setMaterial(debugMaterialGreen); node.attachChild(geom); i++; } return node; }
@Override protected void controlUpdate(float tpf) { body.getBodyA().getPhysicsLocation(a.getTranslation()); body.getBodyA().getPhysicsRotation(a.getRotation()); body.getBodyB().getPhysicsLocation(b.getTranslation()); body.getBodyB().getPhysicsRotation(b.getRotation()); geomA.setLocalTransform(a); geomB.setLocalTransform(b); arrowA.setArrowExtent(body.getPivotA()); arrowB.setArrowExtent(body.getPivotB()); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { body.getBodyA().getPhysicsLocation(a.getTranslation()); body.getBodyA().getPhysicsRotation(a.getRotation()); body.getBodyB().getPhysicsLocation(b.getTranslation()); body.getBodyB().getPhysicsRotation(b.getRotation()); geomA.setLocalTransform(a); geomB.setLocalTransform(b); arrowA.setArrowExtent(body.getPivotA()); arrowB.setArrowExtent(body.getPivotB()); }