Do something while inside an Area3D!
Asked Answered
O

2

0

Hi all! Another quick question here, this one's a lot simpler than the last one. I've got a RigidBody that can enter and exit an Area3D, and I want to do something (say, increase a variable) as long as they are inside it. I drew a simple diagram of what I want to do.

Area3D has signals that detect when an area has been entered or exited, but I need something to happen continuaously while it's inside. How would I check for that? Plz let me know!! Thank you!!

Orcein answered 5/3 at 16:13 Comment(0)
W
0

Orcein If you need something to happen continuously, do it in _process() or _physics_process() as those functions are executed automatically each frame.

To let _process() know that your guy is inside the bubble, you need to use a flag variable. When the guy enters the bubble, set this variable to true, and when he leaves, set it to false. Now _process() can check the state of this flag every frame and act accordingly.

Woden answered 5/3 at 16:24 Comment(0)
O
0

Woden Thank you very much, that's a great solution!! I'll use this 🙂

Orcein answered 5/3 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.