- Home /
Question by
Juvut · Nov 30, 2014 at 09:32 PM ·
transformjumptranslateeulerangles
transform.Translate and transform.eulerAngles bug
Hello, I'm using transform.Translate for walking:
player.transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
and
player.transform.Translate(-Vector2.right * moveSpeed * Time.deltaTime);
And rigidbody2D.AddForce when I want to jump:
player.rigidbody2D.AddForce(Vector2.up * jumpHeight, ForceMode2D.Impulse);`
It's working fine. Now I wanted to add a little rotate effect when it's in air. I did it by transform.eulerAngles:
case Go.up:
katzmiany = 3 * speed;
rotationPlayer = new Vector3 (0, 0, Mathf.Clamp (rotationPlayer.z + katzmiany, 0, 30));
transform.eulerAngles = rotationPlayer;
break;
case Go.down:
katzmiany = -3 * speed;
rotationPlayer = new Vector3 (0, 0, Mathf.Clamp (rotationPlayer.z + katzmiany, 0, 30));
transform.eulerAngles = rotationPlayer;
break;
And again it's working fine. But only when I'm not walking. When I go right my jump is higher. When I go left my jump is lower. It happens only when my script for rotating is working. What should I do?
Comment
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Vector3 Returning Infinity Error 2 Answers
Min-Angle Constraint Script Causes Jitter 0 Answers
Opposite direction in Trigger Enter 1 Answer
Problems with jump script 1 Answer