|Topic was automatically imported from the old Question2Answer platform.
I want to make a game like hollow knight. When i used area2d to check other collisions, i found that i couldn’t get result immediately when i use the method get_overlapping_bodies().
the Document recommend me to use signal like Enter() or Exit(). But sometime when i want to hit the enemies, they are already in the area2d, signal Enter can’t give me the right answer too.
I want just want to make sure if other bodies are closed enough with my player. and hit them in custom frame(I call my method in AnimationPlayer to make sure it can get right result with animation)
so how to use area2d or another node in godot to be the attack area in 2d act game?
is there have any example projects to learn?
Thank you very much
Are you using a
KinematicBody2D or just a plain
Area2D node? In
RigidBodies you can enable a etting called Continuous cd which gives you more precise collisions. A
KinematicBody2D has another option called Sync to Physics under the Motion tab. But it says that it is not wise to use it with
You could also check this if everything else fails. Is this helpful at all?
johnygames | 2020-02-26 10:05
I had what I think is a similar problem to you. My attack Area2D wouldn’t update it’s actual collision detection until the next frame, so there was a single frame delay any time I changed its rotation. What I did instead of using an Area2D was construct an outline of the attack shape using Raycasts instead, because you can call the function
force_raycast_update() to make sure that they have the same frame collision data. That might be something to explore.
denxi | 2020-02-26 14:58