# Adjust Yaw For A Gliding (Like Superman 64) Script

This is a little bit different of a setup from the question answered elsewhere in the forums.
[35101-gliding+pitch+roll+yaw.png|35101]

My character should glide like Superman, rolling and pitching with the joystick, and levelling when the joystick is neutral. (e.g. like this)

In addition, the character should rotate around the global Y-axis.

I am so close, but missing something, and I think I just need a fresh set of eyes. Currently, the pitch and roll behave properly, but I cannot figure out how to add the previous Y-axis rotation to accumulate the rotation:

``````public void AdjustGlidePitchYawAndRoll(float pitch, float yaw, float roll, float speed)
{
Quaternion desiredRotation = Quaternion.Euler(new Vector3(0.0f, yaw, 0.0f)) *                 //I can't figure out how to add the previous yaw properly
Quaternion.Euler(new Vector3(90.0f + pitch, 0.0f, 0.0f)) *       //90 degrees, to make the character prostrate by default, like Superman
Quaternion.Euler(new Vector3(0.0f, roll, 0.0f));
Quaternion rotationThisFrame = Quaternion.Slerp(transform.rotation, desiredRotation, speed * Time.deltaTime);

transform.rotation = rotationThisFrame;
}
``````

This code will only rotate toward the current yaw passed in. How would I get the current yaw so I can increase it each frame?
Simply using transform.eulerAngles.y does not work, because it can change depending on the pitch and roll.

I think what I ultimately want to do is use the current roll as a starting point, but I can only figure out how to start from the identity.

Here’s a package that has my code thus far (GlideRotation1.cs is current code). Maybe someone can open it and see the simple fix for it… :-\

http://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html
`transform.eulerAngles.y + yaw` in your case