Freezerotation of rocket

Hi,

I moved the freezerotation = true inside the if statement and this feels more natural to me: (when not pressing a key the freezerotation is false)
private void RotateShip()
{

    float rotation = rotationFactor * Time.deltaTime;
    if (Input.GetKey(KeyCode.LeftArrow))
    {
        rb.freezeRotation = true; //take manual control over ship
        //Debug.Log("The user pressed the left key");
        transform.Rotate(Vector3.forward * rotation);

    } else if (Input.GetKey(KeyCode.RightArrow))
    {
        rb.freezeRotation = true; //take manual control over ship
        //Debug.Log("The user pressed the right key");
        transform.Rotate(Vector3.back * rotation);

    }
    rb.freezeRotation = false; //give control back to physics engine
}

yeah i think the same with you bro, if we put our freezeRotation = true outside the if statement, isnt it just the same as we freezeRotation all the time?

1 Like

Privacy & Terms