So I have the fps control (by tornado twins) asset from the store and it comes with all the nescessary animations for an m16 but i don’t know how to make the animations play on an input. For example: you make the reload animation play when you press R, fire the gun when you press the left mouse button, or run the sprint animation when you press Shift+w,a,s,d,
Thanks in advance.
Reload:
function Update()
{
if(Input.GetKey("r"))
{
animation.Play("ANIMATON_NAME");
}
}
Fire :
function Update()
{
if(Input.GetMouseButtonDown(0))
{
animation.Play("ANIMATON_NAME");
}
}
Run (front):
function Update () {
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.W))
animation.Play("ANIMATION_NAME");
}
Run (back):
function Update () {
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.S))
animation.Play("ANIMATION_NAME");
}
Run (LeftSide):
function Update () {
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.A))
animation.Play("ANIMATION_NAME");
}
Run (RightSide):
function Update () {
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.D))
animation.Play("ANIMATION_NAME");
}
Thank you a lot. I’m just wondering what the different mouse buttons are called? I assume mousebutton0=left mouse button and mousebutton1=right mouse button but I’m not sure. Thanks again.