Hello, I need help with math. I have a spatial and a vector and need to set the angular velocity of the spatial so that it rotates towards the vector in just the Y axis. The second step would be to calculate the time the rotation would take so I can stop the velocity. Can someone point me to threads/tutorials that might help with calculating the value that setAngularVelocity() needs, please? Thanks for your time.
Edit: Got the rotation working thanks to oskarkv from the IRC
pseudo-code:
contactPoint = collisionResults.getCollision(0).getContactPoint();
rayDir = Batter.getWorldTranslation().subtract(contactPoint);
rayDir.y = 0f;
click3d = Batter.getWorldRotation().multLocal(new Vector3f(0f, 0f, 1f));
click3d.y = 0f;
rayDir.crossLocal(click3d);
if (rayDir.y > 0) {
Batter.getControl(RigidBodyControl.class).setAngularVelocity(new Vector3f(0f, 5f, 0f));
}
else if (rayDir.y < 0) {
Batter.getControl(RigidBodyControl.class).setAngularVelocity(new Vector3f(0f, -5f, 0f));
}