Ship movement & rotation challenge

It moves like a drunken rhino, but I think I’m doing it correctly. Fine tuning will happen before long once I’m sure of the distance I want the ship from the camera. I coupled the roll to the local.x position.

private void ProcessRotation()
{
    // pitch
    float pitchDueToPosition = transform.localPosition.y * positionPitchFactor;
    float pitchDueToControlThrow = yThrow * controlPitchFactor;
    float pitch = pitchDueToPosition + pitchDueToControlThrow;
    // yaw
    float yawDueToPosition = transform.localPosition.x * positionYawFactor;
    float yawDuetoControlThrow = xThrow * controlYawFactor;
    float yaw = yawDueToPosition + yawDuetoControlThrow;
    // roll
    float rollDueToPosition = transform.localPosition.x * positionRollFactor;
    float roll = rollDueToPosition;

    transform.localRotation = Quaternion.Euler(pitch, yaw, roll);
}

I changed out my code for the course code. I think I might have misunderstood something slightly and it seemed more expedient. I’m looking at a game called Star Horizon as a reference for movement in the future.

I think that movement looks good. I’m having a hard time getting mine to look realistic as I’m trying to do a WW2 fighter plane and the movement is different.

I’ll eventually tune my movement for underwater simulation.

Privacy & Terms