- Home /
Autodesk .FBX animation script in Unity
Hi I'm having issues with a model imported from Autodesk. Everything imports correctly and the animations will play ONLY if the 'loop' box is checked in "Animation" in the Inspector. It will play all the animations and then stop them, but I can still move around. I wrote a script to use custom idle and walking animations from autodesk. For some reason I can't get the model to move around the map while playing ANY animations at all. I tried modding the character controller scripts but I am terrible at programming so I'm in kind of over my head. I need the character to move around with a walking animation, stand still with an idle, or attack with an attack, ETC. (you get the point) the game is in alpha so I need to figure out how to do write a script to use these BASIC movements. I am desperate here I've been at this for a week and I can't find anything useful. PLEASE HELP
Answer by Noah-1 · Feb 15, 2011 at 09:42 PM
Hello.
Well if you dont know a lot of programming I really recommend you picking some tuts or books on the topic to get started.
So if you want to create a script to access animations, this is a relly simple one (just a example that can help you):
var Ranger: GameObject;
if (Ranger.transform.position.x > 2){
Animation.CrossFade ("your walk animation");
}
if (Ranger.transform.position.y > 2){
Animation.CrossFade ("your jump animation")
}
This is a pretty simple code to access your primary animations like jump and walk. First I setted up a variable that holds your model, (be sure to drag and drop it).
Then I told unity if the player moves it will start the walk animation (change it to the name of your animation)
I did the same thing for the jump animation.
I hope this helps, good luck Musclegunner.
Awesome thank you very much for the quick responses. The only issue I am running into is... "Assets/CaesiumScripts/Player/BehaviorScript.js(8,15): BCE0020: An instance of type 'UnityEngine.Animation' is required to access non static member 'CrossFade'." I know I'm asking for a mile here but the help is appreciated!
Answer by Eric5h5 · Feb 15, 2011 at 09:20 PM
You can't import scripts from other apps; all scripting must be done in Unity.
I meant how can I write a script in Unity for an FBX file imported from Autodesk