- Home /
Help with collision mechanics
I am working on a naval game with ship to ship based combat. To control player and enemy movement I am using character controllers which works fine for getting everything to work as I want except collisions. As my ships are not spherical in nature, I have created child box colliders for my ships, but no matter what I do I cannot seem to stop my ships from moving through each other. I am quite new to scripting, and the collision systems in Unity just make no sense to me. I have tried a multitude of combinations with rigidbodies, colliders and colliders as triggers, but have had no success.
All I want is for my child colliders to register collisions with the child colliders of other ships, but so far this seems to be impossible without the use of rigid bodies, which do not seem to get along with the character controller (even if the colliders are on a separate layer which should not collide). If anyone could shed insight on to this matter, or introduce a work around so that the collisions will work properly, it would be greatly appreciated.
Forgot to post back, I actually managed to sort of fix the problem myself by adding rigid bodies to the child colliders and then increasing the size of the character controllers a bit. It's not completely perfect, but my ships no longer move straight through each other so I'm chalking it up as a victory.
Just a friendly warning: There are exceptions, but it's generally bad juju to mix character controllers with rigidbodies in the fashion you describe.
As much as it may be a bummer - and again, depending on your goals - it may be wise to drop the character controller from your whole project. They do one thing fairly well, and this isn't it.