this is in godot 4.3 using the VisibleOnScreenNotifier2D specifically.

this is the entirety of my relevant code:

@onready var start_pos = get_parent().position
func _on_screen_notif_screen_exited():
	get_parent().position = start_pos

for some reason when the signal goes off and the ball teleports back, it gets stuck in place and starts flickering back and forth between "true" and "false" for being on screen. this is so simple that I really can't see why it doesn't work on my own.

  • xyz replied to this.
  • xyz

    xyz Rigid body position is not supposed to be set directly via script in the midst of simulation

    this was the key piece of info I needed, changing it to
    get_parent().global_transform.origin = start_pos
    made it start working correctly. thank you!

    xyz

    the only signal connection is the notifier (screen_notif) to itself I mean to the script, not itself

    • xyz replied to this.

      samuraidan Still not enough information. You haven't shown the script that moves the pinball and we don't know if notifier's rect has been properly defined. Maybe best to post a minimal reproduction project.

        xyz the script that moves the pinball is the rigidbody2D script

        this is the visibility rectangle

        looks set up correctly to me, at least.

        • xyz replied to this.

          samuraidan Rigid body position is not supposed to be set directly via script in the midst of simulation. Doing so may cause strange behavior. Hard to debug without inspecting the whole thing. Post the mrp.

            xyz

            xyz Rigid body position is not supposed to be set directly via script in the midst of simulation

            this was the key piece of info I needed, changing it to
            get_parent().global_transform.origin = start_pos
            made it start working correctly. thank you!