I am currently developing an FPS Parkour game. When the player flips it puts the rotation in a wacky position. I made this code so that the player can reset the rotation.
var TargetObject:Transform;
function Update()
{
if (Input.GetKey("r"))
{
TargetObject.rotation=Quaternion.Euler(Vector3(0,0,0));
}
}
The problem is that as you can see at (0,0,0) it resets ALL the rotation. I need it just to reset the Y and Z axis, and leave X where it is. How do I do this?
TargetObject.rotation=Quaternion.Euler(Vector3(transform.rotation.x,0,0));
Try this, also wrong forum
Didn’t work. I already tried it. Which forum is the right one?
Try the programming forum. If you want it to leaveX where it is, you can just do Quaternion.``[Euler](http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=Euler).y=
and Quaternion.``[Euler](http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=Euler).z=
Whenever I see titled “Please Help!” or “Help Me!” I usually skip over it. Not sure why I didn’t this time.
I never do. They’re always trainwrecks and I love watching them.
Regardless of rudeness, please see the rules. They specifically mention not using things like “please help” for topic titles, since doing so is very unhelpful.
–Eric