x


How do I access locomotion groups via script?

So the documentation for the locomotion system says this:

"In your own scripts the Locomotion System can be blended in and out by using a motion group name as an animation name, for example:

animation.CrossFade("locomotion",0.5f);

This will fade the Locomotion System in over half a second."

This doesn't actually seem to work. When I try to do this exact thing with any of the locomotion groups I have setup Unity reports a null reference error like this:

"The animation state LocomotionAgitated could not be played because it couldn't be found! Please attach an animation clip with the name 'LocomotionAgitated' or call this function only for existing animations."

Any ideas what I'm doing wrong? All I'm currently doing is running a tiny little Javascript file on the character to change this animation on Start to make sure it works before I try anything more complex.

more ▼

asked Jan 25 '12 at 06:09 PM

wilco64256 gravatar image

wilco64256
150 6 13 18

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

I figured this out - the locomotion system takes some time when the game is initialized to populate the clips that are generated, if you want to change the animation via script this method works, you just need to make sure it's not done right in the Start function.

more ▼

answered Jan 28 '12 at 05:00 PM

wilco64256 gravatar image

wilco64256
150 6 13 18

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3807
x98

asked: Jan 25 '12 at 06:09 PM

Seen: 636 times

Last Updated: Jan 28 '12 at 05:00 PM