im having problems getting my model to animate movement.
this is my code:
if(Input.GetAxis(“ThrustFoward”))
animation.Play(“foward”);
else
animation.Stop(“Fstable”);
if(Input.GetAxis(“ThrustBack”))
animation.Play(“back”);
else
animation.Stop(“Bstable”);
if(Input.GetButton(“LeftBoost”))
animation.Play(“left”);
else
animation.Stop(“LeftStable”);
if(Input.GetButton(“RightBoost”))
animation.Play(“right”);
else
animation.Stop(“RighStabl”);
am i doin anything wrong here?
If statements are written:
if(somethinghappens) {
//do something
} else {
//do something else
}
Actually silvabrid’s syntax is correct. The braces are optional when you have one statement. The problem is probably using GetAxis when it looks like you meant GetButton.
–Eric
Ahh thanks Eric, I thought if the braces were omitted everything was written on one line.
Sorry about that, silvabrid.
ok ill tryit that way thanks
Ok i changed them from getAxis to GetButton but im still not getting any response from my animations…what do i do?
this is the updated code:
if(Input.GetButton(“ThrustFoward”))
animation.Play(“foward”);
else
animation.Stop(“Fstable”);
if(Input.GetButton(“ThrustBack”))
animation.Play(“back”);
else
animation.Stop(“Bstable”);
if(Input.GetButton(“LeftBoost”))
animation.Play(“left”);
else
animation.Stop(“LeftStable”);
if(Input.GetButton(“RightBoost”))
animation.Play(“right”);
else
animation.Stop(“RighStabl”);