Bug - RespondToRotateInput function is causing slow motion

cu2_s03_spit__polish

#1

Description : I’ve the RespondToRotateInput defined as below

private void RespondToRotateInput()
{
    rocketShipRigidbody.freezeRotation = true;
    ...
    rocketShipRigidbody.freezeRotation = false;
}

This is causing the slow motion effect, in the below video see how the rocket slowly rotates to ground after falling.

This is because the RespondToRotateInput function is always called from Update() and the freezeRotation is turned on and off every frame.

We should rather add a check as below to prevent it from happening, something like

private void RespondToRotateInput()
{
    if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
    {
      rocketShipRigidbody.freezeRotation = true;
      ...
      rocketShipRigidbody.freezeRotation = false;
    }
}

This seems to solve the issue, see below video, check the rotation after falling is now uniform (This check is also required in case of rocketShipRigidbody.angularVelocity = Vector3.zero;)

I was expecting this fix in lecture 71 Spit & Polish.

@ben Any comments?


#2

What an awesome bug report, thanks for the detail.

You’re quite right in your analysis. We were actually going to slow down time to achieve a similar effect, which would have been more correct. In this case this is a “desirable bug”, but that’s pretty unpalatable.

I’ll organise a patch with thanks.


#3

Wow nice catch, I think i accidentally fixed this in my version because it annoyed me that the rocket moved at all on landing so i had an oncollisionenter and so it was froze outside of the update loop.