Hii,
I want to open/close door by a mouse click & i implemented it by rotate the door node & it works well but the physics don’t obey the rotation done on it.
& still blocks the original position of the door.
This is the code for it:
[java]Node Door = (Node) assetManager.loadModel(“Models/Doors/Door.mesh.j3o”);
Door.setLocalTranslation(0f, 0f, -0.95f);
Door.rotate(new Quaternion().fromAngleAxis(180f * FastMath.DEG_TO_RAD, Vector3f.UNIT_Z));
Door.rotate(new Quaternion().fromAngleAxis(90f * FastMath.DEG_TO_RAD, Vector3f.UNIT_Y));
Door.setLocalScale(0.002f, 0.002f, 0.002f);
Node DoorHinge = new Node("DoorHinge");
DoorHinge.setLocalTranslation(3.12f, 2.37f, 29.7f);
DoorHinge.attachChild(Door);
rootNode.attachChild(DoorHinge);
CollisionShape DoorShape = CollisionShapeFactory.createDynamicMeshShape(Door);
RigidBodyControl DoorBody = new RigidBodyControl(DoorShape, 0);
Door.addControl(DoorBody);
physicsWorld.getPhysicsSpace().add(Door);
////////////////////////////
rootNode.getChild(DoorHinge).rotate(new Quaternion().fromAngleAxis(90f * FastMath.DEG_TO_RAD, Vector3f.UNIT_Y));
[/java]
Thanks In Advance,