“Kinematic-Rigidbody Trigger Collider”

Well, I lost a few hours to making my collision work. It all happened because I wanted to drive my GameObjects exclusively on my own, and not depend on the PhysX engine.

The relevant Unity physics documentation page that explains how to make this work is a little more obscure than you’d expect at first, but if you’re making a Unity game where 1) You’re not using the PhysX engine and 2) You want to detect collisions, then here’s what you need to do:

  • Give rigidbodies to all your colliders.
  • On those rigidbodies, set isKinematic to true.
  • On the collider, set isTrigger to True.
  • Detect collisions in the trigger functions, OnTriggerXXX(), not OnCollisionXXX().

That’s it! I’m happy I figured this out during a Ludum Dare, and not on a more important project, but either way I’m glad I know what to do next time.

Comments

joecarrot
25. Aug 2013 · 02:20 UTC
You can also use a characterController.
khakionion
25. Aug 2013 · 02:27 UTC
The character controller didn’t do what I want, but yes, it’s also an option.