So, I really just need help understanding how this bit of the rocket ship script is working? Specifically the freezeRotation modifier.
The way I see it, the Update method calls Rotate every frame. So, the boolean is being set as true and false many, many times per second. How does this make it so that my collisions are more controllable and rotation is more manageable as demonstrated in this lecture? I just cant seem to grasp why altering between true and false would have any useful impact on the game.
code is below.
private void Rotate()
{
rigidBody.freezeRotation = true; // take manual control of rotation
if (Input.GetKey(KeyCode.A))
{
transform.Rotate(Vector3.forward);
}
else if (Input.GetKey(KeyCode.D))
{
transform.Rotate(-Vector3.forward);
}
rigidBody.freezeRotation = false; // resume physics control
}