- Home /
Character won't run straight
I am fairly new to unity and started creating an endless running game in which the player has the ability to slide, jump and of course run.
I am using an animation controller to control the ability to jump and slide based on key input using SetTrigger. The problem I have is that once the game runs my character runs slightly to the left, and when I trigger a jump or a slide my character rotates greatly to the left, almost enough to make a circle, I am aware that it has to maybe do with baking but I am not 100% sure.
I've tried setting the Bake Transformation Rotation to Original for the run animation clip but the slide and jump still move to the left when triggered.
Here's my code (I am not sure if this is any help):
if (anim != null)
{
if (Input.GetKeyDown(KeyCode.J) == true)
{
anim.SetTrigger("Jump");
}
if (Input.GetKey(KeyCode.S) == true)
anim.SetTrigger("Slide");
}
}
Answer by Anox · Mar 16 at 08:53 AM
One solution could be to constrain your rigidbody axis.
Have you tried freezing the Z Positon ( or whatever axis you are using )?