do collision shapes affect performance?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By umma

so i have a scripted lod system that let mesh disappear when you are far. i would like to know if i have to write a script to disable collision shapes also, or it doesn’t matter.

:bust_in_silhouette: Reply From: Help me please

I don’t think if it would matter!
But I think that, if the collision shape is something like the one which we make by clicking on mesh… then trimesh colision or somthing like that. then you should disable that. Because there it is written that “it is least accurate, slowest or lies between the two”, so better if you disable that.
And in case if the collision shape is cube, sphere, capsule etc. Then no problem!

:bust_in_silhouette: Reply From: Calinou

If you disable the collision shape for a RigidBody or KinematicBody, it will pass through solid surfaces unless physics processing is disabled entirely on the RigidBody/KinematicBody in question. Therefore, you have to be careful with doing this.

That said, I think it doesn’t make much of a difference most of the time, especially if you only use one collision shape per PhysicsBody.

:bust_in_silhouette: Reply From: klaas

Hi,
that heavily depends on your game.

Godot allready uses a binary tree to optimize collision tests. So a collsion calculation only occurs when objects are near echother.
My guess would be that a script wouldnt do much of a performance increase in this case.

You can check the impact of the physics on your game in the performance monitor of godot (time->physics_process, physics->collision_pairs etc.)