Jump to content

A useful snippet: SetUpAnimation()


Recommended Posts

This code has seen some interest and controversy, and I've been granting license exceptions for its use, so I thought I'd just release it. There's no magic here, but it's a handy tool for working with animations.

The following is released under a CC0 Public Domain Dedication:

        public static AnimationState[] SetUpAnimation(string animationName, Part part)
{
var states = new List<AnimationState>();
foreach (var animation in part.FindModelAnimators(animationName))
{
var animationState = animation[animationName];
animationState.speed = 0;
animationState.enabled = true;
animationState.wrapMode = WrapMode.ClampForever;
animation.Blend(animationName);
states.Add(animationState);
}
return states.ToArray();
}

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...