0 votes

Hi :)

When my KinematicBody2D enters two Areas2D at the same time is it possible to decide which body_entered would be processed first ?

Without doing anything it's totally random. Also Area2D has a member called priority
( The area’s priority. Higher priority areas are processed first. Default value: 0 ) but it doesn't seem to work as I thought it will.

in Engine by (12 points)

You may be able to use the Object of the body_entered() method. In the first Area2D, have it set an accessible variable with the value true when the Object of the KinematicBody2D sets off the signal. Have the second Area2D check for the accessible variable in addition to looking for the Object of the KinematicBody2D.

That's what I've tried before posting the qestion. The problem is there is no such a thing like first and second Area, they are processed randomly. So if the body_entered() from "second" Area would be call first the flag still be false and it would be processed, and I dont want it .

Ah, race conditions. Drat. :(

Please log in or register to answer this question.

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 [email protected] with your username.