I was Struggling to Understand Continuous vs Continuous Dynamyc

I was struggling to understand why Ben was setting the projectile to continuous dynamic and the player to continuous, until I read the answer here - https://answers.unity.com/questions/1093106/bulletprojectile-collision-question.html

If my game was running so slowly, would that collision happen?

Nope! Not by default, anyway.

You’ve discovered the difference between discrete and continuous collision.

In discrete collision, the position of each object is checked once per frame, and it’s entirely possible for fast-moving objects to go completely through colliders without ever “touching” them. This is the default behavior for most colliders in most engines, because it’s very performant.

Continuous collision is good and bad. It’s good because it’s more accurate and will catch things like a fast-moving bullet that hits a wall. It’s bad because it’s more work for the computer, and that can bog down performance if you’re not careful.

From the Unity manual, you can apply several collision detection models to a rigidbody:

  • Discrete: Use Discreet collision detection against all other colliders in the scene. Other colliders will use Discreet collision detection when testing for collision against it. Used for normal collisions (This is the default value).
  • Continuous: Use Discrete collision detection against dynamic colliders (with a rigidbody) and continuous collision detection against static MeshColliders (without a rigidbody). Rigidbodies set to Continuous Dynamic will use continuous collision detection when testing for collision against this rigidbody. Other rigidbodies will use Discreet Collision detection. Used for objects which the Continuous Dynamic detection needs to collide with. (This has a big impact on physics performance, leave it set to Discrete, if you don’t have issues with collisions of fast objects)
  • Continuous Dynamic: Use continuous collision detection against objects set to Continuous and Continuous Dynamic Collision. It will also use continuous collision detection against static MeshColliders (without a rigidbody). For all other colliders it uses discreet collision detection. Used for fast moving objects.

So, for example, you might set bullets to continuous dynamic and walls to continuous .

Side note: when it comes to bullets, lasers, and similarly instantaneous movement, it is sometimes simpler to simulate all of this behavior by raycasting.

Privacy & Terms