Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | eliasreid |
Hello, I am a Godot beginner. I’m working on a fairly simple 2D game, which has a player that is controlled directly by the mouse, and enemies that travel across the screen that should damage the player on contact. I’m trying to figure out the best way to detect simple collisions, like enemy contact with the player. I don’t want the player and enemy to actual interact / bump into each other, just want to damage the player.
I tried using Area2Ds for both the player and child (circle collision shapes). I was able to set up the collisions masks and get the signal as expected. Seemed to work well until I moved the player very quickly with the mouse, passing right through enemies. This makes sense, as the player’s area could jump over the enemy without spending a frame on top and never overlap.
From what I can tell, PhysicsBody nodes should be more suited for this type of continuous collision detection. But based on the documentation, I shouldn’t be updating their positions directly (which I am violating by setting the Player’s position to the mouse position).
Does anyone know of a simple solution for this in Godot? I’m sure I could hack something together, but want to use the engine built in features as much as possible.