You can still control the
RigidBodyControl with a custom
AbstractControl using some forces , here’s a bit of it’s taste :
Vector3f moveForwardForce=new Vector3f(0f,0f,5f);
Vector3f moveBackwardForce=new Vector3f(0f,0f,-5f);
Vector3f moveRTForce=new Vector3f(-5f,0f,0f);
Vector3f moveLTForce=new Vector3f(5f,0f,0f);
Vector3f jumpForce=new Vector3f(0f,20f,0f);
RigidBodyControl rigidBodyControl=new RigidBodyControl(5f,CollisionShapeFactory.createDynamicMeshShape(npcSpatial));
You can also move this npcSpatial by :
rigidBody.setGravity(moveForward); which basically creates a continuous pulling force towards the vector3f specified in your physicsSpace ,
rigidBody.applyCentralForce(moveForward); which is the same as impulse but this gets cleared after being applied .
NB: applyCentralForce or applyCentralImpulse is basically applying a force on the object assuming it’s effective center is the object center ie (0,0,0) w/ respect to the object node.
if , you need to change the effective center for this object during the application of the force , use :
Where offset is a vector3f instance , that’s used as an effective center for perception of that force.