Even though the rocket rotation is constrained from rotating on the x and y axis, when it collides with the sphere sometimes it rotates on what I believe is the y axis. Is this what is happening and is there a way to prevent it. You can see it happen near the end of the video.
Hi Daz,
Welcome to our community!
I don’t know in which lecture you are but do you have this piece of code in your Rocket class?
void ApplyRotation(float rotationThisFrame)
{
rb.freezeRotation = true; // freezing rotation so we can manually rotate
transform.Rotate(Vector3.forward * rotationThisFrame * Time.deltaTime);
rb.freezeRotation = false; // unfreezing rotation so the physics system can take over
}
If so, test this:
void ApplyRotation(float rotationThisFrame)
{
rb.angularVelocity = Vector3.zero; // set the angular velocity to (0f, 0f, 0f)
transform.Rotate(Vector3.forward * rotationThisFrame * Time.deltaTime);
}
Did this fix it?
See also:
- Forum User Guides : How to mark a topic as solved
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.