diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-30 02:18:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-30 02:18:01 +0200 |
commit | bcd1fc832fff5c1cc1efa4d2450b9e2919b972c9 (patch) | |
tree | 29faf789f29140425af80b605a4c08b472a68f77 /servers/physics_server_2d.cpp | |
parent | 9b8095ad05d41d0bd3aa2afbdd2228b064b49d1b (diff) | |
parent | 9758a75221854b5ed533bc826ebba1beb7f8cf3f (diff) |
Merge pull request #49901 from nekomatata/move-and-collide-fix-slide
Fix move_and_collide causing sliding on slopes
Diffstat (limited to 'servers/physics_server_2d.cpp')
-rw-r--r-- | servers/physics_server_2d.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index faab4f43b8..12200989fd 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -487,6 +487,18 @@ int PhysicsTestMotionResult2D::get_collider_shape() const { return result.collider_shape; } +real_t PhysicsTestMotionResult2D::get_collision_depth() const { + return result.collision_depth; +} + +real_t PhysicsTestMotionResult2D::get_collision_safe_fraction() const { + return result.collision_safe_fraction; +} + +real_t PhysicsTestMotionResult2D::get_collision_unsafe_fraction() const { + return result.collision_unsafe_fraction; +} + void PhysicsTestMotionResult2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_motion"), &PhysicsTestMotionResult2D::get_motion); ClassDB::bind_method(D_METHOD("get_motion_remainder"), &PhysicsTestMotionResult2D::get_motion_remainder); @@ -497,6 +509,9 @@ void PhysicsTestMotionResult2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_collider_rid"), &PhysicsTestMotionResult2D::get_collider_rid); ClassDB::bind_method(D_METHOD("get_collider"), &PhysicsTestMotionResult2D::get_collider); ClassDB::bind_method(D_METHOD("get_collider_shape"), &PhysicsTestMotionResult2D::get_collider_shape); + ClassDB::bind_method(D_METHOD("get_collision_depth"), &PhysicsTestMotionResult2D::get_collision_depth); + ClassDB::bind_method(D_METHOD("get_collision_safe_fraction"), &PhysicsTestMotionResult2D::get_collision_safe_fraction); + ClassDB::bind_method(D_METHOD("get_collision_unsafe_fraction"), &PhysicsTestMotionResult2D::get_collision_unsafe_fraction); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "", "get_motion"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion_remainder"), "", "get_motion_remainder"); @@ -507,6 +522,9 @@ void PhysicsTestMotionResult2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_depth"), "", "get_collision_depth"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_safe_fraction"), "", "get_collision_safe_fraction"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_unsafe_fraction"), "", "get_collision_unsafe_fraction"); } /////////////////////////////////////// |