- Home /
.fbx Model to Rigidbody Character Controller
Hi guys,
I'm making a RPG game. I done the all character control scripts with example character object which is Capsule Model. Then I import my character to unity and I transfered all components to Model and somethings gone wrong.
My old capsule model has : RigidBody , Character Controller, Capsule collider and Player Movement Script. All of them works perfectly with capsule model.
My movement script is using rigidbody to addForce for moving model, also using transform.Rotate for rotating model.
Problem is my .fbx Model came with 1 parent GameObject which has animator component and two Child GameObject which are Armature and Mesh . Mesh object has only mesh component, it is okay. But; 1-) if I add my movement script to armature, with all components (collider, cc, rigidb.), It doesn't rotate or move IN PLAY MODE. (transfom.rotate doesnt work)
2-) if I add my movement script to Parent object of armature and mesh, script needs rigidbody, also even i attach to rigidbody to parent, it is falling and not colliding.
***I solved first problem with transform.parent.rotate but with this way I still cant move the object because the moveing part of script using rigidbody.
What is the best way to add components to .fbx model? or Where should i attach the components to .fbx model?
Thank you!!!
My -some- part of movement code(THIS CODE IS WORKING PERFECTLY);
//Movement
input = new Vector3 (Input.GetAxisRaw ("Horizontal"),
0,
Input.GetAxisRaw ("Vertical"));
if (rigidbody.velocity.magnitude < maxSpeed) {
rigidbody.AddRelativeForce (isGrounded?(input * moveSpeed ):(input * moveSpeed * airMoveReduction));
}
//Mouse Look
mInput = new Vector3 (0,Input.GetAxisRaw ("Mouse X"),0);
if(! Input.GetMouseButton(1))
transform.Rotate(mInput*rotateSpeed);
This is the my .fbx model's hierarchy , which is I mentioned above;

Answer by OllyNicholson · Jun 23, 2014 at 02:58 PM
I would apply your character controller scripts and components to an empty parent node. Take a look at the sample assets for best practice:
https://www.assetstore.unity3d.com/en/#!/content/14474
Unity Support
Your answer