|
Hi, So I made a basic animation and attached it to a sword. (First Person MMO?) It will make the sword swing. But I am not a scripter!!! How do I start this animation when I press a certain button??? I want to swing the sword by clicking the mouse. Is this a trigger??? Please help!
(comments are locked)
|
|
Nope it's not a trigger. Check what Unity has named your mouse button by going in Edit->Project Settings-> Input. Then simply create a new Javascript and write these down under function Update. if(Input.GetButtonDown("MouseButtonName")) { animation.CrossFade("name of the animation"); } This should be simple enough. Make sure you've assigned the animation to the object and assign this code to your sword. It should work. The animation to what object??? BTW Thx For the help.
Aug 03 '10 at 03:07 PM
Collinbxyz
(comments are locked)
|
|
You should make sure that in the Inspector Window your Sword object should have the name of the animation that you're going to use under the "animation" box. Click on your Sword object, in the Inspector Window there should be a part called "Animation". There's usually a standard one that comes with the model. Add your animation there. Hope this helps. This could also be useful; http://unity3d.com/support/documentation/Manual/Character-Animation.html#IntoScene
(comments are locked)
|
