Best practices for dealing with high velocity collissions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mark_90
:warning: Old Version Published before Godot 3 was released.

Problem
What are the best best practices when dealing with very high velocity objects that shoot through other colliders and why do they do so in the first place.

Context
The question has been asked before here: https://forum.godotengine.org/1250/how-to-properly-handle-high-speed-collisions

However, even though some of the answers do work, they are not ‘optimal’. E.g. limiting the speed of a high velocity object seems to be a remedy but not the cure. Furthermore, I fail to see why objects shoot through colliders in the first place.

:bust_in_silhouette: Reply From: VitaZheltyakov

The best way to avoid these problems is not to add objects to the game with high speed.

Use Project Settings → Phisics → fixed_fps = 120

:bust_in_silhouette: Reply From: eons

All the answers on that post are good for normal uses.

Godot CCD works with small objects at around 10k units/s which is really high (ray based CCD gives incorrect results but the collision point is the same as shape).

If you want insane speeds then you will have to make your own CCD technique, Godot offers many tools to do your own physics.

Why objects shoot through colliders? because of tunneling.

A ray cast to the bullet’s current velocity vector from the bullet’s current location seems like the simplest and dumbest solution to tunneling.

Per frame delta, ofc.

Performance cost, no idea. Doing a ray cast every frame? pff. Doing 10k ray cast per frame, need RTX!

TeaCrab131 | 2022-08-06 19:06