Issue with Area2D BodyEntered with RigidBody2d

Godot Version

4.5_dev 3

Question

I have a RigidBody2d with a CollisionShape2D. I also have a separate Area2d node which also has a collisionShape2D.

If the RidgidBody2d has a non-zero gravity scale and it drops into the Area 2D then the bodyEntered signal fires properly . GOOD

If the RidgidBody2d has a zero gravity scale and I give it a linear velocity to make it run into the Area 2D then the bodyEntered signal fires properly . GOOD

If the RidgidBody2d has a zero gravity scale and no velocity and I move it in the _process method with position.x += 100 * delta then the RidgidBody2d moves, but when it enters the Area2D the bodyEntered signal DOES NOT fire. BAD

I want to have a car moving down a road and I want it to know when it enters an Area2D in front of an intersection so it can slow down and wait for a light. But moving the position of the RidgidBody2d via the position attribute seems not to fire the body entered signal.

Is this the expected behavior?

It is recommended in the docs not to directly alter positions of physics bodies. If you need to change the position of a rigid body, do it in the integrate_forces function.

2 Likes

OH, Of Course.

I’ve used that before. I don’t know why I’ve forgotten about that.

Thank you

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.