The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Problem with One-Way Collisions

if global_position.distance_to(grapple_collision_point) > 8: global_position = global_position.move_toward(grapple_collision_point, grapple_speed) else: state = IN_AIR

This is the code for my function. grapple_collision_point is the colliding point of a raycast2d node with the world. This code works as intended for the most part, but when the raycast2d collides with a platform with one-way collisions, it continues moving global_position to about halfway through the platform instead of to the edge of the collision box (this happens from either direction - whether the player would normally collide with that side or not). This same platform works fine if I turn off one-way collisions.

Is this a bug with how one-way collisions are detected or is my code at fault?

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 3,129Admin

    Welcome to the forums @BenRavioli!

    I haven't used one way collisions enough to know for sure, but it sounds like a may be a bug. I'd see if other users who are more familiar with 2D physics and one way collisions chime in, but based on my limited experience, this sounds like a bug.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file