How do i get the direction vector of a PhysicsVehicleNode? Feel like im missing something simple here. Trying to setup a chase camera.
Hmm that returns a quaternion. How do i get a direction vector from a quaternion? Or am i looking at this from the wrong perspective?
A PhyiscsNode is a normal node, so getLocalRotation etc. should work.
just found player.getVehicle().getForwardVector(null) but it gives me a null pointer. not sure why it wants a vector passed to it.
Update:
Ahh i figured it out.
Vector3f direction = player.getLocalRotation().getRotationColumn(2);
Vector3f direction2 = player.getLocalRotation().getRotationColumn(1);
float yDirection = direction2.y;
float xDirection = direction.x;
float zDirection = direction.z;
Then i created a chase cam with
Vector3f camLocation = new Vector3f(player.getWorldTranslation().x+(xDirection*10), player.getWorldTranslation().y+4f, player.getWorldTranslation().z + (zDirection*10));
cam.setLocation(camLocation);
cam.lookAt(player.getWorldTranslation(), Vector3f.UNIT_Y);