Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Mecanim Scripting Dynamic Animation

I have a scene with one fully-rigged model of human body and I would like to users could make their own animations by transforming the model.

I am talking about an app with time-line and possibility of rotating certain muscles.

Could you please recommend me some way how to do that?

I can imagine storing some information about model state in certain times.. but I do not know how to save it as an animation.

like image 730
Michal Krča Avatar asked Nov 01 '22 06:11

Michal Krča


1 Answers

You can't edit animations at runtime. You can create an animation from scratch and use AnimationClip.SetCurve to build up your animation, but you can't access the curves directly at runtime.

However in an editor script you can use the AnimationUtilitys to modify an Animationclip, but of course only in the editor since this is an editor class.

Answer picked from this thread.

I think best possible solution for you is to create many different animations for every body part by your own and let user to choose different combinations of animations (if you are using Animator or Animations). Or you can split model by body parts and let user change transform parameters with iTweens (move from A to B and change angle from C to D). Then u can easily save object's "from" transform and object's "to" transform and use it as animation.

like image 125
Utamaru Avatar answered Dec 21 '22 22:12

Utamaru