When and when not to use kinematic rigidbody?

I have a VR game with a scene with a few enemies that the player can aggro, and then kill them with a few sword swings. There are no physics interactions (things bouncing off one another), just colliders passing through each other. Currently, everything only has colliders on them, no kinematic rigidbodies. The docs say that if a collider moves around with no rigidbody (a static collider), it has a performance cost, and there can be inaccuracies with raycasts and such.

Apparently the performance cost of moving a static collider was drastically reduced in a 5.x build at some point. This seems true because I made a scene of 1000 moving cube with and without kinematic rigidbodies. When I ran the game without kinematic rigidbodies, I got ~70fps. When I ran the game with kinematic rigidbodies on the cubes, I only got ~13fps, with most of the processing going to the physics (I also used the rigidbody.position to move the cube).

So by those numbers, I feel like if I’m not using a rigidbody to behave with physics, I should just not use it because it adds more processing. But, does not having a kinematic rigidbody on a collider cause inaccuracies still? Is it fine for my sword and enemies to only have colliders and no kinematic rigidbody? Or what is most efficient/accurate way?

It is getting hard to trust what the docs say…

Based on your description I think you need is trigger colliders with kinematic rigidbodies. Rigidbodies because they move, trigger because things don’t bounce off each other, and kinematic, because they are moved by logic.

Why do I say this? Well, this is how I basically think about physics in Unity. A game object…

  • …without collider: does not take part and/or care about physics; purely logic or visual

  • …with trigger collider: a static (non-moving) detector area, for triggering logic when something enters it

  • …with (non-trigger) collider, without rigidbody: static physical object, real, solid things that won’t move, like walls, the ground, etc.

  • …with (non-trigger) collider and non-kinematic rigidbody: dynamic physical object, a thing that moves according to the laws of physics, like boxes, balls, projectiles, etc.

  • …with (non-trigger) collider and kinematic rigidbody: dynamic physical object, but it doesn’t behave purely with physics, usually because it is moved by player input or animation or some other logic

These cover most cases and makes it pretty clear what to use in what situation. Note that you can switch kinematic on and off depending on the situation. For example, normally your player character can move with user input with kinematic rigidbody, but when it gets blown up by and explosion you make it non-kinematic and let physics handle how it flies and falls.

Btw, as far as I know these are all the collider types in 3D: SphereCollider, BoxCollider, CapsuleCollider, MeshCollider, AND CharacterController.

You did the right thing. You tested it - don’t worry about what the conventional wisdom is, worry about results. I’ve run similar tests with similar results and I move my colliders around without rigidbodys too.