In the Complete C# Unity Game Developer 3D course, @7:25 of video 39 in the project boost section, we wrote the code below to disable the physics engine of the rigidbody when the player is rotating the object. This was breezed over in the lecture and I would appreciate a better explanation. I understand the concept, but I’m not sure how it’s working. I under stand that the rb.freezeRotation = true/false, freezes and unfreezes the rotation of the rigidBody, but what conditions are the true/false referencing?
I would have imaged that we would have created and if/else if statement that froze the physics of the rigidBody when colliding with a box collider and unfroze the physics when the rigidBody is not colliding with anything. For example, if rigidBody is colliding with another object than rb.freezeRotation = true, else if rb.freezeRotation = false.
Freeze physics code from lecture: