Problem with the animation of the legs

Hello everyone,
Sorry for my english,

I am about to try to create a TopDown game Shooter, and I have a problem with the animation of the player’s legs.

The rotation of the player execute with the position of the mouse, and I can not make the animation of the legs follow depending on the position of the body …

Example :

Here is the code of the rotation player:

void LateUpdate() {


        Plane playerPlane = new Plane(Vector3.up, moi.position);
     

        Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);


        float hitdist = 0.0f;

        if (playerPlane.Raycast(ray, out hitdist))
        {

            targetPoint = ray.GetPoint(hitdist);
         
 
            targetRotation = Quaternion.LookRotation(targetPoint - moi.position);

            transform.rotation = Quaternion.Slerp(moi.rotation, targetRotation, speed * Time.deltaTime);

            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100)){
                if(Input.GetMouseButton(0) && peutTirer == true){
                    if(GetComponent<NetworkView>().isMine){
                        GetComponent<NetworkView>().RPC ("tir", RPCMode.All, hit.point);
                    }
                }
            }

        }

    }

And the code for animation legs send to Blend tree :

void Update (){

        float h = Input.GetAxis ("Vertical");
        float x = Input.GetAxis ("Horizontal");

        //anim.SetFloat ("xrotat", targetRotation.x);

        if (GetComponent<NetworkView> ().isMine) {

            GetComponent<NetworkView> ().RPC ("move", RPCMode.All, x, h);

            if (Input.GetKeyDown (KeyCode.F) && torcheAllu == true) {
                GetComponent<NetworkView> ().RPC ("allumetorche", RPCMode.All, 0);
            } else if (Input.GetKeyDown (KeyCode.F) && torcheAllu == false) {
                GetComponent<NetworkView> ().RPC ("allumetorche", RPCMode.All, 1);
            }
        }
    }

I do not know if you UNDERSTAND, I put you so this link to an example of my game.

Just click on “créer un serveur”

http://www.ricl-chatland.fr/test2/
(117Mo sorry)

Thanks for your help,
Cordialy

up? please

up :frowning:

This might help you:

It’s nice but I can not afford to pay such a sum of money, another solution please? :frowning:

I don’t understand your code but I guess (from trying your web demo) the solution would be to not choose the leg animation from the keypresses but from the direction your character is facing compared to where he is moving. If you move him using the rootmotion from the animation you might need to find another solution for that to make it work. But I’m really just guessing here, I know almost nothing about the animation system. Watch some more tutorials, I’m sure this topic is covered in at least one of them.