summaryrefslogtreecommitdiff
path: root/servers/physics_server_2d.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics_server_2d.h')
-rw-r--r--servers/physics_server_2d.h32
1 files changed, 8 insertions, 24 deletions
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index df39d6ae50..6737aacaf0 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -92,8 +92,6 @@ public:
PhysicsDirectBodyState2D();
};
-class PhysicsShapeQueryResult2D;
-
//used for script
class PhysicsShapeQueryParameters2D : public RefCounted {
GDCLASS(PhysicsShapeQueryParameters2D, RefCounted);
@@ -203,26 +201,6 @@ public:
PhysicsDirectSpaceState2D();
};
-class PhysicsShapeQueryResult2D : public RefCounted {
- GDCLASS(PhysicsShapeQueryResult2D, RefCounted);
-
- Vector<PhysicsDirectSpaceState2D::ShapeResult> result;
-
- friend class PhysicsDirectSpaceState2D;
-
-protected:
- static void _bind_methods();
-
-public:
- int get_result_count() const;
- RID get_result_rid(int p_idx) const;
- ObjectID get_result_object_id(int p_idx) const;
- Object *get_result_object(int p_idx) const;
- int get_result_object_shape(int p_idx) const;
-
- PhysicsShapeQueryResult2D();
-};
-
class PhysicsTestMotionResult2D;
class PhysicsServer2D : public Object {
@@ -493,6 +471,9 @@ public:
Vector2 collision_point;
Vector2 collision_normal;
Vector2 collider_velocity;
+ real_t collision_depth = 0.0;
+ real_t collision_safe_fraction = 0.0;
+ real_t collision_unsafe_fraction = 0.0;
int collision_local_shape = 0;
ObjectID collider_id;
RID collider;
@@ -500,7 +481,7 @@ public:
Variant collider_metadata;
};
- virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) = 0;
+ virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.08, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) = 0;
struct SeparationResult {
real_t collision_depth;
@@ -514,7 +495,7 @@ public:
Variant collider_metadata;
};
- virtual int body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin = 0.001) = 0;
+ virtual int body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin = 0.08) = 0;
/* JOINT API */
@@ -619,6 +600,9 @@ public:
RID get_collider_rid() const;
Object *get_collider() const;
int get_collider_shape() const;
+ real_t get_collision_depth() const;
+ real_t get_collision_safe_fraction() const;
+ real_t get_collision_unsafe_fraction() const;
};
typedef PhysicsServer2D *(*CreatePhysicsServer2DCallback)();