0 votes

Is the only difference between using integrate_forces and Physics2DServer.area_set_param ( area, param, value ) is that former is for individual nodes while the latter is for whole area or space in which nodes are present? Also which is more efficient(In terms of workflow and better to maintain).

in Engine by (51 points)

1 Answer

+1 vote
Best answer

There is some small overlap in results that you can achieve, but overall they serve different purposes, so you can't compare them in such a black and white manner.

Bodies and Areas are two different things. _integrate_forces() is a method to override the default integration of a RigidBody, and the area_set_param() is to change a property in an Area.

Areas can alter a few physics effects, so if the effect is just to dampen or alter gravity in a specific space. It would probably be better to do that with an Area, than individually overriding the integration of any RigidBody that enters a certain point.

Though, if you're looking to do things specifically to only individual RigidBodies, or get detailed information about it's collisions, it's space state provides much more than the physics modifications that can be done by an Area.

http://docs.godotengine.org/en/stable/classes/class_physicsdirectbodystate.html#class-physicsdirectbodystate

by (5,276 points)
selected by
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.