“Rotate Ship With Position And Throw” pitch code unclear

Hey guys , in the lecture of “Rotate Ship with position and throw” for the pitch of the spaceship Rick wrote “transform.location.y * positionPitchFactor + yThrow * controlPitchFactor”, my question is , Why does Rick add (yThrow * controlPitchFactor) and not multiply it by these 2 values (yThrow * controlPitchFactor)?

Here’s what I understand we’re taking the Y position value and putting that into the x.rotation(pitch)
And because the value is too small we multiply it with a factor (positionPitchFactor) but that results in the spaceship being stuck in a pitched up or down rotation, so in order for the rotation to revert back to 0, we connect the players input (yThrow), and this is where it gets unclear, why does he add this instead of multiplying?


Welcome to our community! :slight_smile:

Admittedly, this lecture was fairly complex. Have you already rewatched the video at least one more time?

Hi there, yes I’ve watched it about 3/4 times now :sweat_smile: I understand everything else from the lecture but just not that bit :thinking:

In which course are you? And could you share the relevant code snippet? I tried to figure out to which lines you are referring.

This is Rick’s script for lecture “Rotate Ship with position and throw” in the remastered Unity 3D course.

float pitchDueToPosition = transform.localPosition.y * positionPitchFactor;
        float pitchDueToControlThrow = yThrow * controlPitchFactor;
        float pitch = pitchDueToPosition + pitchDueToControlThrow;

and specifically :

float pitch = pitchDueToPosition + pitchDueToControlThrow;