Collision detection refresh problem: Newbie suspects a bug in the engine

Godot Version

4.3 stable

Question

Hi everyone,

Short story: I created a bifurcating snake thingy, and used raycast to detect collisions with Area2Ds, and yes I enabled detecting areas too. Each tick, I update snake head positions. Since they are multiple heads, the positions already changed would not register for collision detection; sure head merging is cool, but that’s not what I was going for, (and they are not really merging, they are still two of them.) OK, so I need to trigger collision shape refresh.I added await get_tree().physics_frame before progressing with each head (increased the physics frame rates, since no actual physics is involved); haven’t quite done the trick. Instead I called force_raycast_update() on my ray casts, which didn’t help either. Only when I combined both, it worked. So, I believe there’s a bug in the engine. I exported two boolean variables for each of the methods, so it can be demoed and debugged.
I have a video: https://youtu.be/qslZGH0OzKQ
You can access my code: GitHub - rshouker/Bifurcating at collision-detection-problem
Is it my bug, or the engine’s?

Long story: more than 30 years ago, in the MS-DOS era, (which was an improvement over the Apple 2 I was using before :older_man:,) when Borland C++ 1.0 arrived at the scene, encouraged by the ease of spawning multiple objects, I first created something similar in text mode, using the special characters which were meant for tables like and . Collision detection was simply checking whether the character on a given position on the screen is not a space. Now that I’m learning Godot, I decided to reproduce this with (lame) graphics, and maybe later have non right angle turns, now that I have in my disposal an engine with more sophisticated collision detection abilities; maybe even a 3D version later (remember the Windows XP pipes screensaver? wouldn’t it be cool if they would bifurcate?) However, I am unnerved by the current experience with collision detection.

Thank you for the attention and feedback.

1 Like