Hey guys just a little stuck with animator. I have this raycasting script to open doors on a mouse click with animations through animator(if that makes sense). I have made four animation with four transitions inside the animator so it goes Door Closed > Door Opening > Door Open > Door Closing. So it all connects together. I’ve tried playing with the parameters but nothing is working and I have named the parameter the same as in the script. What kind of parameter do I choose and do I have to change anything around. I have tried bool, into and float and I’ve tried playing around with the greater and lower part but just can’t get it working?
Here’s the script below:
using UnityEngine;
using System.Collections;
public class DoorRaycast : MonoBehaviour
{
public Animator anim;
void Update()
{
RaycastHit hit;
Vector3 fwd = transform.TransformDirection (Vector3.forward);
if (Physics.Raycast(transform.position, fwd, out hit, 10))
{
if (Input.GetMouseButtonDown(0)&& hit.collider.tag=="DOOR")
{
anim.SetTrigger("DoorOPEN");
audio.Play();
}
}
/*{
anim.SetTrigger("DoorCLOSE");
audio.Play();
}*/
Debug.DrawRay (transform.position,fwd,Color.green);
}
}