- Home /
This question was
closed Sep 29, 2018 at 07:41 PM by
hexagonius.
Question by
daleonard · Sep 29, 2018 at 07:14 PM ·
c#rotationeulerangles
Rotation of player not working
I am making a game where the character can flip his gravity, but when he does, he will also rotate 180 degrees.
currentAngle = new Vector3(Mathf.LerpAngle(currentAngle.x, targetAngle.x, Time.deltaTime), Mathf.LerpAngle(currentAngle.y, targetAngle.y, Time.deltaTime), Mathf.LerpAngle(currentAngle.z, targetAngle.z, Time.deltaTime));
transform.eulerAngles = currentAngle;
rigid.velocity = new Vector3(rigid.velocity.x, 0, rigid.velocity.z);
gravY = -gravY;
if (inverted)
{
targetAngle.x = 0;
} else
{
targetAngle.x = 180;
}
What happens when i run this is that the characters rotates 8 degrees and then stops. How do i solve this problem? Thanks.
Comment