To develop a animator using unity with C# prgram and move the animator.
Download 2 crouch idle from maximo 3d. Drag it and drop it in unity asset.
Select one crouch and in the inspector choose rig-> Animation type (humaniod) and then click update.
Perform the step 2 for another crouch
Select one crouch and in the inspector choose Animation-> Root transform rotation-> Based upon (original) and check the Loop Time and click apply
Perform the step 4 for another crouch
Drag one crouch, put it in hierarchy and name it as Player.
In the Player inspector we have Animator. Right click in Assets-> create -> Animator Controller (name it as IdleToCrouch)
Drag the IdleToCrouch to the Controller option under the Animator in the inspector. Click that IdleToCrouch , a window opens and select parameter tab , create 2 parameter, InputX and InputY
Select the another crouch and attach with Entry button and name it as movement. Right click it and choose create blend tree.
Click the movement button, blend tree opens. Choose InputY in parameter and under the motion click โ+โ sign and choose add the motion field twice.
Drag the second crouch and put it motion field, then drag the first crouch and put it in the another motion field.
Uncheck the automata threshold and change the values -1 and 0 in first column( priority for the crouch). Create a C# file and name it as IdleToCrouch, drag it to the player
Download a walking crouch from maximo 3d and drag it into unity. In the inspector select rig-> animation types(humanoid) -> Apply
Select the crouch and in the inspector choose Animation-> Root transform rotation-> Based upon (original) and check the Loop Time and click apply
In blend tree, in blend type choose (2D Freedom Directional), parameter (InputX, InputY) , one crouch (0,-1,1) and walking (1,0,1). Bring the camera under the player
Name:G.TEJASWINI
Reg no:212222230157
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class exp6 : MonoBehaviour
{
public Animator animator;
public float InputX;
public float InputY;
void Start()
{
animator = this.gameObject.GetComponent<Animator>();
}
void Update()
{
InputX = Input.GetAxis("Horizontal");
InputY = Input.GetAxis("Vertical");
animator.SetFloat("InputX", InputX);
animator.SetFloat("InputY", InputY);
}
}
![Screenshot 2023-11-07 091642](https://private-user-images.githubusercontent.com/121222763/280914626-f5e3ab1b-bf31-4456-86ac-c92b5f74f7df.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNjk2OTMsIm5iZiI6MTcyMjE2OTM5MywicGF0aCI6Ii8xMjEyMjI3NjMvMjgwOTE0NjI2LWY1ZTNhYjFiLWJmMzEtNDQ1Ni04NmFjLWM5MmI1Zjc0ZjdkZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOFQxMjIzMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yMTRiY2NiNmNjOWEwOTVhYTEwM2M3Zjk5YzhjMjcyMWFhOTQ1MzEzMmFhNzFlZjFhN2ZkMDk5M2QxZjA3OGVlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Vg4cXU9Tq1HL83WuRd78t_YEoUOIlKfWf-jCCxskNLA)
Thus, the animator was successfully developed in unity engine with the C#.