0 votes

What I want is to get current gravity direction? Is there something like Physics2DServer.getgravityvector() .
I tried Physics2DServer.space_get_param(get_world_2d().get_space(), Physics2DServer.AREA_PARAM_GRAVITY_VECTOR) but gives a float value 1.5 not gravity direction vector.

in Engine by (51 points)

1 Answer

+2 votes
Best answer

AREA_* parameters are for area_* methods, you are doing SPACE_PARAM_CONTACT_MAX_SEPARATION (value 1) with that parameter.

What you want is:

Physics2DServer.area_get_param(
    get_world_2d().get_space(),
    Physics2DServer.AREA_PARAM_GRAVITY_VECTOR)
by (7,910 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.