Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GameVisitor |
Hi all,
I am building a simple demo made of 2 scenes:
- main scene containing the floors
- cube scene
Upon loading the main scene, i am generating some cubes at random position.
collision code snippet:
_ready():
...
set_physics_process( true )
set_max_contacts_reported( 1 )
And
_physics_process(delta):
var bodies = get_colliding_bodies()
for curBody in bodies:
print( "collision :" + curBody.get_name() )
I am getting lots of prints and collisions, however:
- Is this the correct way / “best performance” way of detecting collision in 3D ? I am asking this, cause having a simple scene with 40 cubes, makes the game “choke” for like 2 seconds.
- Some collisions seems to pass undetected (even though CCD is enabled).
Btw, I am using Godot 3.0.5
Did you leave your print
during the 40 cubes test? Printing is an expensive operation, so it should not be used to logspam.
Also, collisions can go undetected because you did set_max_contacts_reported( 1 )
.
Zylann | 2018-07-23 12:51