- Home /
Easy Animation/Modeling question
I am going to make a tank in blender and want the turret to animate pointing upward when the the up arrow is pressed and point downward when the the down arrow is pressed. Is this something I create an animation for or do I create the objects as two different fbx files and put them together in Unity and write code to manipulate the turret? Or is there a way to leave it as one FBX file but still allow code to just move the turret around?
Answer by tingham · Mar 08, 2012 at 05:17 AM
You have two options really:
Add an armature in Blender and bind it to your mesh. Then fill in your weight maps for the bones that represent the various animatable components.
Create your object as a series of separate mesh items in Blender. Ensure that the pivot point of your turret object is at the hinge where you want it to rotate.
Once you've done either of these, you can then create a script that will link to the sub-components of your game object mesh (I usually capture all transforms in Start and assign the various pieces by name; but you can do this however you like.)
After you have references to either the Bone in the Armature; or the sub-component that is appropriately offset; you can rotate the transform of either of those objects independently of the rest of your mesh composite.
Answer by tdaniels · Mar 09, 2012 at 02:12 AM
Thank you so much! I think you've saved me a ridiculous amount of time researching this.
Will do when I can actually vote things up. I guess I've got to get more $$anonymous$$arma first.
Your answer
Follow this Question
Related Questions
How to make enemy run animation 3 Answers
How would I go about making an animation affected by this script? 1 Answer
Controlling Animation ON TOUCH 0 Answers
How to make a Kill Counter 1 Answer
Turret AI Script 1 Answer