Hi all any help would be great!
I have an animated character and I’m just trying to get him to walk when i click the right mouse button at a target location and then stop.
This is possible to do but its not instant and i have tried to change the transition time but with no effect so i tried to force it with booleans and script it but this doesn’t seem to work ether.
Plus it doesn’t stop the character from working making it go back to idle.
In animator i have a boolean called IsWalking true and false.
Bool true → Idle to IsWalking
Bool false → IsWalking to Idle
think thats everything if I’m missing any info let me know what you want to know and i will host it asap.
Ideas examples and references welcome…
Thanks
public NavMeshAgent agent;
private Animator anim;
public bool walking;
void Start(){
agent = GetComponentInChildren<NavMeshAgent> ();
anim = GetComponentInChildren<Animator> ();
}
void FixedUpdate(){
if (Input.GetButtonDown ("Fire2")) {
RaycastHit hit;
if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100)) {
agent.destination = hit.point;
}
}
Animations ();
}
void Animations(){
bool walking = Input.GetAxis ("Vertical");
anim.SetBool ("IsWalking", walking);
}