i have stuck on this blendtree animations driverik steering wheel hands

Hello i’ am Majed

i have a problem with blendtree slider moves -1f 0f 1f with horizontal mathf lerp
when i hit start the game the hands not moving and slider in blendtree moves but without moving animation

i have 3 animaitons
Left angle steer
idle
right angle steer

what should ido to run animation correct way ?
alt text
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class inputManager : MonoBehaviour{
    public float m_HorizontalMovement;
    Animator DRIVE_BASE;
	private float turn;
	
	void Start()
    {
        DRIVE_BASE = gameObject.GetComponent<Animator>();
	}
	
    void Update()
    {
		m_HorizontalMovement = Input.GetAxis("Horizontal");
		turn = Mathf.Lerp(turn , -m_HorizontalMovement , 20 * Time.deltaTime);
		DRIVE_BASE.SetFloat("Blend" , turn);
	}
	
}

thanks for help

Hello @yeesgamer (Majed)

The issue with your code might be related to the value range of your Blend parameter in the Animator. Make sure that the Blend parameter in the Animator is set to the correct range of -1 to 1. You can also try changing the Mathf.Lerp() function to Mathf.SmoothDamp() to smoothly interpolate the value. Try this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InputManager : MonoBehaviour
{
    public float m_HorizontalMovement;
    Animator DRIVE_BASE;
    private float turn;
    private float currentVelocity;

    void Start()
    {
        DRIVE_BASE = gameObject.GetComponent<Animator>();
    }

    void Update()
    {
        m_HorizontalMovement = Input.GetAxis("Horizontal");
        turn = Mathf.SmoothDamp(turn, -m_HorizontalMovement, ref currentVelocity, 0.1f);
        DRIVE_BASE.SetFloat("Blend", turn);
    }
}

Make sure to set the correct range for the Blend parameter in the Animator. Also, note that I have changed the class name to “InputManager” (So if you copy paste this code, you will need to rename the .cs file in you editor as well.) to follow C# naming conventions. If you still face issues with the animations, please check your Blend Tree setup and ensure that the correct animations are assigned with the correct thresholds.

HEYYYYYYYYYY BRO
ITS WORKS

YOU KNOW THE ANIMATION COMES WITH CHARACTER IF U DUPLICATED IT
AND ASSIGN IT TO BLENDTREE NOT GONNA WORRK
BUT IF U KEEP IT ON CHARACTER AND ASSIGNED WORKS
THANKS VERY MUCHHHHHHHHHHHHHHHHHHHHHHHHH