Continuous Collision Detection (CCD)
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
Continuous Collision Detection (CCD) is a physics technique that prevents fast-moving objects from passing through (or "tunneling through") thin obstacles by checking for collisions along an object's entire movement path.
By default, Godot's physics engine moves objects directly to their target position and performs a single collision check at the final position calculated this frame. In other words, after you moved every object during a physics update, the engine takes a snapshot and checks for collisions between the objects at that moment. This is efficient and works well for most cases.
This approach can cause problems with games that have fast-moving objects and small collision shapes: objects might completely pass through thin walls or never overlap with other objects. CCD solves this by doing more collision checks along the movement trajectory of objects. It makes it much more likely to detect intersections between objects at the cost of performance.
Concretely, CCD works by firing a raycast or shapecast between the object's previous and target position. So, you can use the built-in CCD option instead of manually adding raycasts to your objects to check for collisions more accurately.
In Godot, CCD is not enabled by default due to its performance cost. You can enable it selectively on fast-moving RigidBody2D and RigidBody3D nodes by toggling their continuous_cd property. You can also access the physics servers and call body_set_continuous_collision_detection_mode() to set the CCD mode for a specific physics body. Here's an example where we enable raycast-based CCD for a CharacterBody2D node:
var player: CharacterBody2D = $Player
var player_resource_id: RID = player.get_rid()
PhysicsServer2D.body_set_continuous_collision_detection_mode(player_resource_id, PhysicsServer2D.CCD_MODE_CAST_SHAPE)Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…