- Home /
Getting Character controller to fit model?
I have this model, which uses a character controller, but I can't get the capsule to fit it nicely. I need it to cover it entirely so it collides properly when it moves, but I can't rotate the collider to be along the z-axis like a normal capsule collider, and I can't increase the radius too much because then it just makes the collider way to large on the sides! Does anyone have a solution? thanks
Can't you just attach an empty gameobject with a spherical collider to the mesh and attach it to the dragon mesh and then move it into position around the head? Or add a mesh collider to the entire mesh, which will be more memory intensive, but would match the mesh.
@Julian Glenn, the problem with using a combination of colliders to move using a CharacterController
, is that fisrtly, all other colliders will collide with the CharacterController
and secondly, they will not affect movement.
@pickle chips
The only way to avoid this, is to use either the physics system. Or write a movement system yourself.
As a quick fix you could scale the CharacterController
to encompass the entire model, but from your question, that is not what you want.
Also you can't rotate the character controller, it's impossible
grrr... $$anonymous$$aybe I'll just have to deal with it being super wide...
I think there is a way if you use the system found in the Angry Bots project.
It uses the $$anonymous$$ovement$$anonymous$$otor class, and the Free$$anonymous$$ovement$$anonymous$$otor class is attached to the gameObject.
A reference is stored to the Free$$anonymous$$ovement$$anonymous$$otor script :
public var motor : $$anonymous$$ovement$$anonymous$$otor;
then feed it normalized Vector3s for movementDirection and facingDirection :
motor.movementDirection = Input.GetAxis( "LeftStick Horizontal" ) * screen$$anonymous$$ovementRight + Input.GetAxis( "LeftStick Vertical" ) * screen$$anonymous$$ovementForward; // screen$$anonymous$$ovement vars are Vector3s
motor.facingDirection = Input.GetAxis( "RightStick Horizontal" ) * screen$$anonymous$$ovementRight + Input.GetAxis( "RightStick Vertical" ) * screen$$anonymous$$ovementForward;
So you shouldn't have to modify your code that much. Just change to feeding normalized vectors and controlling the speed on the Free$$anonymous$$ovement$$anonymous$$otor. Then you hopefully should be able to use compound colliders and a rigidbody for your character.