I am playing with the Roll A Ball project and trying to replace the ball with a sliding cube.
I want the cube to turn and point in the direction it is heading.
I have been playing with this code:
var targetRotation = Quaternion.LookRotation (rigidbody.velocity);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * rotationAdjust);
But I am getting erratic behavior with the cube rotating all over the place.
I am only concerned with altering the left/right orientation of the cube through the script. What would be the best approach for fixing this?