Checking position with Rigidbodies


I need a mechanic where if you knock the ball offscreen it gets re spawned onscreen.  The obvious solution would be to use the visibility node that come out of the box with Godot.  as soon as I added it, however; my ball stopped reacting to physics at all.

What happened vs what I expected to happen - notice the stuttering as if I was manipulating the position directly

Thinking that this was a problem with the visibility notifier node I decided to manually check using the balls global position.  unfortunately even doing this caused the physics engine to go walk-about.

Now I'm using a Area2D connected to the camera and a body_exit event but I have no idea why querying the position cause the rigidbody to stop working.  Obviously making updates to the position isn't wise but I figured using getters would be fine.  I guess not though.  I wonder what that means for working out the distance from rigidbodies - if I can't call distance_to(Vector2()) I wonder how I'm meant to do it.

Leave a comment

Log in with itch.io to leave a comment.