- Home /
Quadrupeds Character Controller
Is there a Character Controller equivalent for Quadrupeds?
My main character and NPCs are quadrupeds animals. I have been using the Character Collider, but the problem is that the player and the NPCs can stick their heads or tails into other characters, which I want to avoid. I tried adding Box colliders to the GameObjects, but they don't seem to work. Is there any way to change the default Character Controller collider shape? like changing the default capsule for a box collider?
Is there another way to solve this? Mesh colliders? Box colliders? Can I have both the Character Controller component and a Box Collider at the same time in the same GameObject? Is there any difference if the secondary Box Collider is attached to a child object of the one that has the Character Collider? What would I need to do at scripting level to make it work?
Any help is more than welcome.
Thanks
Answer by Arbbot · Jun 14, 2010 at 06:18 PM
After a really deep research on available options, the only solution I found is to sacrifice Top collisions accuracy to have side collision accuracy. This means that you can still use the CharacterController standard Unity component, and just make it a lot taller than the actual model. This will give you a better shape for side collisions although the CC collider will be a lot taller than the model, which means that top collisions will not be accurate, but at least this works fairly well. By the way, locomotion does not solve this problem, and it doesn't have anything to do with the actual CharacterController colliders. It actually uses the same Unity CharacterController component.
@$$anonymous$$ Pasek Thank you. Your option helped solve my problem. I just $$anonymous$$imized the Character Controller x,y,z all to 0 and attached empty object as a child. Then added box collider to it and resized it to be same as its parent. Wel Done. :)
Answer by equalsequals · May 26, 2010 at 07:28 PM
I believe that it's only 1 Collider per GameObject. (If you try attaching a BoxCollider to an object that has a CapsuleCollider already, it'll prompt you to replace) However, that does not stop you from having sub-GameObjects that are just Colliders. That is a completely acceptable way of setting things up on your character.
MeshCollider objects will not collide with other MeshCollider objects, only primitive Colliders (Box,Sphere,Capsule... etc) unless marked convex.
--On a personal note I have found convex Colliders to act a little wonky in some instances, so avoid them if you're not familiar with how all of this stuff works.
Hope that helps.
==
Thanks for your comment. I have my player GO with my Character Collider. Then, as a child object I have my animal model with a box collider attached. The box collider is a little bigger than the actual model mesh, which is fine. However, I can still stick the head on the animal into other objects and characters. What else do I need to do in order to avoid this? Do I need to check for the model's box collider collisions in my Third Person Controller scripts? I'm not sure if the Box Collider generates the collisions by default, or if I need to check for them in my TPC.
Thanks
Just to clarify: I have my "player" GO with a Character Controller attached to it (with its capsule collider). Then, as a child object, I have an empty GO with a box collider that covers the space of the child GO that contains the model mesh. But it doesn't solve the issue. What do I need to do to get the BoxCollider collisions right?
Player GO (character controller)
Collider Container GO (box collider) --- $$anonymous$$odel GO (mesh)
Thanks
Unity will handle all the collisions for you, the only way the tails/heads will come in contact with anything outside of the encapsulating Collider is if A) part of the mesh protrudes from the Collider B) The object it is clipping with does not have a Collider encapsulating it entirely.
Still not working. - Player GO: has a Character Controller with the capsule collider it comes with it. The capsule collider is smaller than the child GO containing the animal model $$anonymous$$esh. -- BoxCollider Container GO: child of the player GO with a Box Collider bigger than the child object containing the animal model mesh. --- Animal $$anonymous$$odel GO: contains the animal model mesh.
At the higher level I'm using a character controller. And in the child object I have the box collider (isTrigger = false). But still, when the player gets near other characters, I can still stick my head into the other characters, which shouldn't happen. Both characters, the player and the NPC have a character controller, and both of them have a child object with a big box collider.
Answer by Tetrad · May 26, 2010 at 07:29 PM
I already saw this thread, but as far as I understand, the locomotion system doesn't solve the character collision problem. Am I right?