Colliders vs Triggers - what is ideal if you don't use physics?

Hi all,

I am working on a TRON game in which I intend to control the motion and interaction of objects by scripts. I want to eliminate use of rigidbody physics altogether, as I am controlling all translation information by scripts. Say I want to catch an event of my player colliding with the wall. I believe I have two options here: Either I make the player an IsKinematic rigidbody and the wall a trigger, or I make both of them colliders. This should allow me to call onTriggerEnter or onCollisionEnter, respectively. Is there a way to determine which is the best choice, both in simplicity and performance?

The player will need to have a rigidbody and collider in order for OnTriggerEnter or OnCollisionEnter to be called, however, I don’t believe OnColliisionEnter will be called if the rigidbody of your player is kinematic. See docs:

So I think your only option is to use triggers.

1 Like

I see, thank you.

So if I want to control all translations by hand (i.e. script), my only choice for collisions is to make walls, trails etc. triggers and make the player a collider (without rigidbody). Does that sound right?

On that note, I am creating a narrow tron trail which obviously needs to detect if the player passes through. This could be done with raycasts or with procedurally placed box colliders. Is there an obvious preference in terms of precision and performance?

No. A rigidbody is required for any trigger on at least one of the objects.

If you are set on translating the player manually via the Transform component, then I would say the easiest thing to do would be to add a rigidbody to the player, set isKinematic to true, then use colliders as triggers for trails and other collidable stuff.

As for using raycast or procedurally placed box colliders . . . the raycast will only work if there is something to raycast against, i.e., colliders, so this question doesn’t make sense. But I think, perhaps, what you are really asking is should raycast be used instead of relying on OnTriggerEnter. If that is the case, then I would say go with the raycast, because then you will have valuable information on the “collision,” which will allow you place the player at the point of impact. There were will also not be any chance of your player passing through the walls/trails, which may or may not be an issue with triggers.