+1 vote

I'm trying to optimize using servers, and I find two very similar functions in the PhysicsServer. One is the:
PhysicsServer.area_set_monitor_callback(...)
that you can read about here, and the other is the:
PhysicsServer.area_set_area_monitor_callback(...)
that you can read about here.

As far as I understand, the methods are both used to define the function that should be called when a body interacts with the given area (entering or exiting the area).

My question is: what is the difference between them?

in Engine by (141 points)

1 Answer

+3 votes
Best answer

area_set_monitor_callback is for monitoring bodies.
area_set_area_monitor_callback is for monitoring areas.

However the documentation confuses me because it says area_set_monitor_callback monitors both: https://docs.godotengine.org/en/stable/classes/class_physics2dserver.html#class-physics2dserver-method-area-set-monitor-callback
While area_set_area_monitor_callback is not documented at all. Same in 3D.

by (28,733 points)

Awesome! Obvious in retrospect. Thanks dude!

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 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 webmaster@godotengine.org with your username.