Hi All
Wonder if someone could outline the basic approach to achieve the following.
When an FBX file is imported the objects have animations, I want to split those animations up and add them as clips to each object so in game I can select one of those animclips to play. All I get when I import is one Animclip and each object has that added. How do I go about adding clips to each object?
I have tried adding clips with ModelImporterClipAnimation in a custom AssetPostProcessor and I do see the animclips in the inspector under the fbx section, but is this right? Will the clips play per object OK. When I look at the object in the inspector the the Animation section only shows the main clip. Guess I just dont understand the whole animation system at the moment and need a little guidance from the exerts here
Hope someone can shed some light on this for me.
Chris
click on the .fbx object to call it up in the inspector.
double click on the animation clip “Take01”
That will call up a window with Name, Start, End, Wrapmode, and Loop. (See photo below). Click on the plus sign at the right to add more clips, type in start and end points (frame number), name each clip, select wrap mode, and you’re done. Now these animations can be called up like this:
// "Animations.js" -- Animation controller script
//
function Start () {
animation.wrapMode = WrapMode.Loop;
animation["jump"].wrapMode = WrapMode.Once;
animation["sit"].wrapMode = WrapMode.Once;
animation.Stop();
Idle();
}
function Walk() {
animation.CrossFade("walk", 0.3);
}
function Run () {
animation.CrossFade("run", 0.3);
}
function Idle () {
animation.CrossFade("idle", 0.3);
}
function Jump () {
animation.CrossFade("jump", 0.3);
}
Thanks for the help chaps. The thing is Iam trying to automate the process from Max. I have added user props to objects defining the anim frame ranges and names for each sub anim on an object and I am trying to get these to work in Unity.
I have the animclips importing fine as can be seen here:
Max User Props
Imported to Unity
So then when I run the test anims also appear as expected and plays though it wont wrap
So all seems fine except for the non wrapping anim problem, but if the asset gets reimported it ends up with all the anims added and every object gets all the anim clips.
So is it possible at all to have individual animclips playing for each seperate object from an imported set of objects, or does it require that each object be exported individually. Still very confused with the whole Anim system as you can no doubt tell. Just want to be able to define in Max clips per object and be able to play them in Unity on an object basis so only one object is effected by the anim.
Probably all as clear as mud but I hope someone can shed some light on why the anim isnt wrapping and why I get lots of animclips on reimporting an object and why each object ends up with all the anims.