I have a question that was asked before.
I implemented the following code into my spaceship:
RaycastHit hitInfo;
if (Physics.Raycast(transform.position, -Vector3.up, out hitInfo, 40.0f))
{ Quaternion rot = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
transform.rotation =
Quaternion.Slerp (transform.rotation,rot, Time.time * centeringSpringForce);
}
Right now, the code will align and recenter my Z axis to the normal of the polygon underneath my ship, but it also freezes my ships ability to be rotated in the other axis. It freezes my Y and Z rotation to 0 (or very close to 0), and perfectly locks my ship to the z value of the normal underneath my ship. I’ve been scratching my head for a little while now, do you have any ideas for what might be causing my ships X and Y rotation to be frozen at around zero?