Author Topic: Colliders / Triggers driving me INSANE!  (Read 390 times)


  • Full Member
  • ***
  • Posts: 235
Colliders / Triggers driving me INSANE!
« on: October 12, 2020, 02:43:40 AM »
I'm at my wits end with this, it is literally doing my head in and I'm wasting so much time going backwards and forwards trying to sort out Colliders and Triggers.

I hate the hierarchy parent/child system when it comes to colliders and triggers. I have one Collider on my spaceship, the body, and one Trigger which is a large sphere around the spaceship that acts as a sensor to nearby objects.

Some of my objects (asteroids, aliens, scenic objects etc) require colliders, and some triggers, and some both. I just want the large spherical Trigger on the spaceship to do just that, but depending on what's the trigger senses, it sends events that should only be sent if the spaceship collides with an object on the body, like picking up health or smart bombs.

I seem to be going down this stupid rabbit hole of constantly having to reverse engineer logic because things keep messing up.

It is doing my head in and to be honest, I'm pretty p***ed off with the whole thing.


  • Sr. Member
  • ****
  • Posts: 480
Re: Colliders / Triggers driving me INSANE!
« Reply #1 on: October 12, 2020, 04:01:49 AM »
To keep them separate, the different types of collisions should be on different game objects. They can also be parented, which makes no difference. Now that the colliders are differentiated, you also need to give them different logic.

To do this you can use the tag and layermask to efficiently detect relevant stuff. Once you detect an object, you could read any property from it, like the existence of a component, values inside its FSM and so on.

Under project settings and physics, somewhere, you can also tweak the collision matrix.

If your game has a lot of objects coming to the ship, also potentially simultaneously, you need a more robust solution that can keep multiple detections in an array and then loop through them for relevant information.


  • Full Member
  • ***
  • Posts: 235
Re: Colliders / Triggers driving me INSANE!
« Reply #2 on: October 12, 2020, 04:30:26 AM »
Thanks Thore,

Apart from using an array, I have done everything you mentioned... different objects for different colliders, the ship body has a small sphere collider that detects collisions on the actually spaceship (hitting ground, hitting enemy etc) and the large sensor field is a larger sphere collider Trigger which is on a separate object which is a child of the spaceship.

I'm using Tags, Layers and collision matrix to sift through the different types of object collisions... I think it's becoming a convoluted mess, and I'm finding it hard to see the woods for the trees.

I'm considering paying somebody to go through it all and clean it up.

Thanks for your comments though, every little bit helps.