I have a game object with a character controller and a large mesh that moves around the screen. I want them to collide.
Currently, a collision occurs when the character bumps into the mesh. When the mesh bumps into the character, a collision does not occur -- the mesh just passes through the character.
I'm aware that this asymmetry exists because of how character controllers are implemented. I've seen a few solutions for these types of issues posted, but all of them involve simple platforms, not arbitrary meshses. If I need my character to be knocked around by an object with a mesh collider, do I have any good alternatives other than making my character a rigidbody and recoding a lot of its controls? Note: the large mesh in question will always be a child of another character controller, if that helps.
Have you thought about adding similar code to the mesh?
You mean add a character controller to the mesh? That would be nice, except for the fact that character controllers seem to come with capsule colliders built in (and I need the meshes to retain their mesh colliders).
Note: for others out there who encounter similar problems, I've managed to make things work decently well by swapping out my character controller for something I adapted from the following script: http://www.unifycommunity.com/wiki/index.php?title=RigidbodyFPSWalker
It would be nice if there was an easy way to enable character controllers to collide with a certain subset of game objects, though, 'cause rigidbody physics is a lot rougher.
I mean to add similar collision code to the mesh. Since the mesh has a collider, you can call its collision event when something collides with it, and have the same events happen in that collision event.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
5 People are following this question.
Mesh Collider + Character Collider + moving Platforms
Character Controller with rigidbody
Interactive distributed tile network needs to detect player
Character Controller strange collision bug
Odd character controller behavior when a shield object parented to child