-
-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.1.4] Collision offset of Area2D when parent is in movement #11879
Comments
Bodies and area are moving 100 units per fixed frame (6000 per second?), detection is going to fail that way for sure. But fails anyway at around 1100 units with is a lot slower, not sure if the area or the kinematic child gets delayed for the Physics server (both area and body report position [0,0]). |
Exactly
Why so? Is there a maximum speed at which collision detection works properly? |
Well, yes, if you move at high speed on a non CCD mode, you need to implement something for the case or the small hitboxes will be prone to fail on overlaps (a bit bigger shapes increase a lot the failure point value). But the problem here is at slow speeds too and does not fail (so fast at least) with rigid bodies, so it should be something else. |
Made a test with Area2D and it seems to work fine, the problem is only with KinematicBody2D like if the body position used by the server gets delayed a frame. I'll try to test this on 3 too (so it gets more attention). |
I wish I could help, but this was something I stumbled upon in my very first project. But I would be interested as well if it only affects 2.1.4 or also 3.0. |
Yes, affects 3 too. Ping to @RandomShaper who knows better this kind of things. |
I'll have a look ASAP. |
I'm researching... So far I haven't found a way to fix it. |
Does this problem disappear if you enable Sync to Physics on the KinematicBodies? See #3092 (comment). |
On 3.2.2 b1, |
Godot 4.2, the same happened to me, I managed to fix this issue by writing the raycast collision detection through code (in the Physics Process) rather than using the RayCast3D node. |
Enregistrement.de.l.ecran.2024-04-01.a.18.19.48.movOn Godot 4.2 I have encountered this issue also: |
Operating system or device, Godot version, GPU Model and driver (if graphics related):
Issue description:
The scenario
KinematicBody2D
)Area2D
to detect a collision (i.e. if the player inside the cockpit, so the 'Action' key triggers the 'player-enters-cockpit' action)The Problem:
Area2D
Area2D
will move ahead of the ship. I.e. there is an offset (see illustration below)Here's an illustration (desired/expected place of collision in a moving ship in red on the left, and the actual place of collision in red on the right):
Worth mentioning
collide()
ofRectangleShape2D
for the player model and theArea2D
inside_fixed_process()
, I get correct results. However, this is not really practical, since I need to know all possible collision objects in advance... I would expect, that thebody_enter
andbody_exit
events honour the_fixed_process
-ing (i.e. that the calculations which lead to these events are synchronous with_fixed_process
)Steps to reproduce:
body_enter
andbody_exit
events in theprint
output"ENTERED"
in the output. If you toggle to a fast speed, you should see, that the player left the cockpit according to the engine (indicated by"LEFT"
)The text was updated successfully, but these errors were encountered: