+2 votes

When I move KinematicBody2D with move(), Area2D emits body_enter signal only if the collision shapes of these bodies overlap at the end of the move. If the kinematic body passes through the area and finishes behind the area, the signal is not emitted.

Is that expected and wanted behaviour or is it a bug? I would expect that the signal is emitted every time the kinematic body passes through the area.

in Engine by (675 points)

I'm not familiar with physics, but there is an option for physics at Project Settings > Physics > fixed fps
try to increase this fixed fps value, like 120.

I think that it is not a physics problem because if I change Area2D to StaticBody2D and make the same move, the KinematicBody2D stops as expected.

This isn't a bug, but an unrealistic expectation of the Area2D. I believe your KinematicBody2D is moving pretty fast in relation to the size of your Area2D. The Area2D really should be something where a body enters it on frame X and will be there for several frames afterwards. I don't know the internals of the Physics Engine, but the PhysicsBody2D's are much more optimized to handle these types of collisions(short) you described. You most likely need to increase the size of your Area2D.

I understand that. And this is also my amateurish explanation to it. But I definitively have no idea how the physics bodies and areas are implemented in Godot. That is why I asked. So probably it is an expected behaviour.
(From my naive point of view I was expecting that Area2D is able to detect exactly the same collisions as other physic bodies.)

1 Answer

+2 votes
Best answer

Objects in games do not use a real movement, they moves the programmed amount.

When using overlap detection (case of areas here or non solid/trigger on other engines) if the bodies minimum motion is greater than the area, they will jump over it and the overlap will never occur.

Is not the same between PhysicBodies, rigid and kinematic (using move) will try to avoid tunnelling against "solid" objects.

So, your problem is the design, the area is too small to see a body at high speed.

To fix this, reducing the problematic speed is not an option, usually.
You can try:

  • Increase the area size according to the speed (not common but sometimes is possible).
  • Add a raycast that grows with speed, use it in the moving body to predict overlaps.
  • Change the detection zone, you can use Line shapes instead, these are currently buggy on bodies (as solids) but work fine with Area2D.
by (7,896 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.