Question by
TheRedPlanet · Jun 29, 2016 at 01:11 AM ·
animationscripting problem
How do I get my animated Object to switch animations on Collider?
Hey guys, I`m a little new to coding and I have been working on a animated character model "Paladin" in Unity 5. The thing is, I want him to switch animations when the model hits a physics collider. I made a code here in JavaScript but even when he hits the collider he wont play the new animation :(
#pragma strict var Character : GameObject ; function Start () { } function Update () { } function OnTriggerEnter (other : Collider) { if(other.gameObject.tag =="Paladin"){ GetComponent.().Play("walking paladin"); } }
Comment
Answer by TheRedPlanet · Jun 29, 2016 at 01:13 AM
Here is how the code looks in Monodevelop just in case it is hard to read the code from the post :)
[1]: /storage/temp/73144-bandicam-2016-06-28-21-12-27-866.jpg
bandicam-2016-06-28-21-12-27-866.jpg
(42.0 kB)