I do a FirstPersonController and when I press shift and I dont pressed any other key. My character do the running animation. But I dont want it. I want do running animation when I move. Plz Help me
I have a characterController attach to my Player GameObject and my FirstPersonControllerScript.
This is my code… I dont think my other code is needed because is just a MouseLook and escuse me for to much line. I didn’t not erease them all… is in a practice and thank you an advance. Escuse me for my english to
I try a solution in this code with search the lastposition and current position but I dont know how to say to Unity in the if(currentPosition == lastPosition after certain of time)
Do…Nothing or something like that.
I get a red Ligne each time I try to get two thing and say is Équal to himself
I dont have isRunning false because I dont know how to check if the player is in place and I see a lot of post with the codeFile download but its ok…
Just learn to read my question… its not difficult. You cant respond me because you dont see my code. But its bizzare when the moment I show my code. Dont have an anwser. I post my code because some guy’s is like to be a princess and I dont have an answer. All programmer is a joke into Unity? I explain the essencial. just explain your logic to my problem. You dont need my code for this.
Have a look at animation states and animation transitions. Specifically, transition properties.
A simple & common way to do this is by having your character blend between an idle and moving animation depending on their velocity.
I.E:
You could create a “movementSpeed” float property for your animator, and update it using the magnitude of the “offset” Vector3 you’re creating here:
Then add a transition between your idle animation and running animation using the “movementSpeed” property as the condition.
If “movementSpeed” < x, transition to the idle animation.
If “movementSpeed” > x, transition to the running animation.
You could additionally multiply the running animation’s playback speed with the “movementSpeed” property to play the animation faster/slower depending on how fast the character is moving in the scene.
if (offset.magnitude < x) //A got an error for the x value. The error message is : The name x does not exist in the context.
{
playerAnimator.SetBool(“isRunning”, false);
}
float x = Input.GetAxis(“Horizontal”);
float y = Input.GetAxis(“Vertical”);
I put this after and I got my x value. But after that is not the same value of my parameter in the animator float “movementSpeed”. How I can get the x value.
I can try to put the float x in my parameter of the animator?