Ever had the problem where you’re firing a bullet or some kind of projectile at high speeds, and it just goes right through the collision object, instead of hitting it?
Here’s a weapon that fires a bullet at random velocities, to demonstrate the issue:
The bullets impact the character in various places, rather than at the first point of contact. I haven’t found a way to enable any kind of continuous contact option, outside of playing with the
safe_margin
setting. I ended up adding a raycast:
It’s definitely a hack, though. The
move_and_collide
should be replaced by the ray query. Using both instructions together could result in an even weirder situation;
move_and_collide
could skip a collision object (the issue we’re trying to fix with the ray query), but then still collide with a different collision object. Then the ray query redoes the same movement and collides with the first object that was missed by
move_and_collide
. Depending on the game, that could mean something like randomly shooting through shields or walls under specific circumstances.
The current approach is essentially a two-pass solution, where the first pass is sloppy, and the second pass works as intended, but doesn’t move the projectile.
Godot Engine 4 has a bug (#50824) that causes particle jitter when the game is paused. It does look quite distracting. The Bug in Action This is a proof-of-concept wave shooter running in Godot Engine 4.0.2. Pausing the game was initially just a simple process_mode toggle. But as shown in the video clip above, there …
When I think of video games, I generally still think of an application that is downloaded and runs on the client. Technically, that’s still the case with web-based exports from Godot Engine, since the web browser has to download the files before being able to run them. I thought maybe I could just run the …
Right after I got my Steam Deck, I wanted to know how hard it is to get a Godot game running on it. What’s the developer experience for someone who’s stepping through this for the first time? It was really easy to do, so I’m sharing this here, whether you’re following along or like to …
A new version of the Inventory System is available. This version requires Godot Engine 4.3 and includes many refinements. New Drag and Drop system The Drag-and-Drop component has received a major overhaul. The previous system was quite complex and the separation of the classes that implemented the click-and-drag and click-and-release approaches had so much overlap …
Projectiles going through collision objects
Ever had the problem where you’re firing a bullet or some kind of projectile at high speeds, and it just goes right through the collision object, instead of hitting it?
Here’s a weapon that fires a bullet at random velocities, to demonstrate the issue:
The bullets impact the character in various places, rather than at the first point of contact. I haven’t found a way to enable any kind of continuous contact option, outside of playing with the
safe_margin
setting. I ended up adding a raycast:The ray cast looks somewhat like this:
It’s definitely a hack, though. The
move_and_collide
should be replaced by the ray query. Using both instructions together could result in an even weirder situation;move_and_collide
could skip a collision object (the issue we’re trying to fix with the ray query), but then still collide with a different collision object. Then the ray query redoes the same movement and collides with the first object that was missed bymove_and_collide
. Depending on the game, that could mean something like randomly shooting through shields or walls under specific circumstances.The current approach is essentially a two-pass solution, where the first pass is sloppy, and the second pass works as intended, but doesn’t move the projectile.
Related Posts
The Pause Handler: Working around Godot 4’s particle jitter bug
Godot Engine 4 has a bug (#50824) that causes particle jitter when the game is paused. It does look quite distracting. The Bug in Action This is a proof-of-concept wave shooter running in Godot Engine 4.0.2. Pausing the game was initially just a simple process_mode toggle. But as shown in the video clip above, there …
Quickly deploying Godot games on the web with Netlify
When I think of video games, I generally still think of an application that is downloaded and runs on the client. Technically, that’s still the case with web-based exports from Godot Engine, since the web browser has to download the files before being able to run them. I thought maybe I could just run the …
Running Godot Games on Steam Deck
Right after I got my Steam Deck, I wanted to know how hard it is to get a Godot game running on it. What’s the developer experience for someone who’s stepping through this for the first time? It was really easy to do, so I’m sharing this here, whether you’re following along or like to …
Inventory System v1.16 available
A new version of the Inventory System is available. This version requires Godot Engine 4.3 and includes many refinements. New Drag and Drop system The Drag-and-Drop component has received a major overhaul. The previous system was quite complex and the separation of the classes that implemented the click-and-drag and click-and-release approaches had so much overlap …