+1 vote

I am trying to figure out how the one_way_collision_direction parameter of a PhysicsBody2D object works.

In the documentation, it is written :
void set_one_way_collision_direction( Vector2 dir )

Set a direction in which bodies can go through this one. If this value is different from (0,0), any movement within 90 degrees of this vector is considered a valid movement. Set this direction to (0,0) to disable one-way collisions.

However, in the Kinematic Character exemple, the platform vector is (0,1), and the player can go up through the object.
I seems that it works the opposite way to the documentation, or I am missing something?

By the way, as it is a direction vector, is it the same to set it as (0,1) or (0,2) ?

Thank you

in Engine by (288 points)

Better set direction vectors to normalized values, just in case...

That's what I would do indeed :)

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.