******Worked on the script and got some progress so changed question to what I am dealing with now.******
So I have a script for setting the animations by the velocity of the Rigidbody. This works fantastic. But now I am trying to overcome of what to do when the transform is rotated so the velocity's are changed between X and Z.
***MY QUESTION IS:***
Is there another better way to do this? Am I going at this all wrong? If not...
Ok, my script works every where expect getting the Strafing animations to play correctly.
**Running Code**
if(rigidbody.velocity.z <= -0.1f && rigidbody.velocity.x >= -4.7f && transform.eulerAngles.y >= 80 && transform.eulerAngles.y <= 180)
{
characterModel.animation.CrossFade("Run");
}
**Strafing Code**
if(rigidbody.velocity.x >= 0.1f && rigidbody.velocity.z <= 4.5f && transform.eulerAngles.y >= 0 && transform.eulerAngles.y <= 88)
{
characterModel.animation.CrossFade("StrafeRunRight");
}
Basically what I am thinking is that I need something else that I could reference for when I am strafing. Since both running and strafing effect both X and Z when the transform is rotated.
I just can't think of what to do next. Any help would be appreciated. :)
↧