From fab9c19d2e2dbc29081a9faeb6d88af0232fa863 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Mon, 7 Jun 2021 10:40:15 -0700 Subject: [PATCH] Fix uninitialized members in physics query results (cherry picked from commit c6bd0fd0f76e3ce30804fe15fb28552134955e2b) --- servers/physics_2d_server.h | 16 ++++++++-------- servers/physics_server.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index b94174a439e..8f68f12e352 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -164,9 +164,9 @@ public: Vector2 position; Vector2 normal; RID rid; - ObjectID collider_id; - Object *collider; - int shape; + ObjectID collider_id = 0; + Object *collider = nullptr; + int shape = 0; Variant metadata; }; @@ -175,9 +175,9 @@ public: struct ShapeResult { RID rid; - ObjectID collider_id; - Object *collider; - int shape; + ObjectID collider_id = 0; + Object *collider = nullptr; + int shape = 0; Variant metadata; }; @@ -195,8 +195,8 @@ public: Vector2 point; Vector2 normal; RID rid; - ObjectID collider_id; - int shape; + ObjectID collider_id = 0; + int shape = 0; Vector2 linear_velocity; //velocity at contact point Variant metadata; }; diff --git a/servers/physics_server.h b/servers/physics_server.h index 4c3e590179b..128e6f2c677 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -158,9 +158,9 @@ public: struct ShapeResult { RID rid; - ObjectID collider_id; - Object *collider; - int shape; + ObjectID collider_id = 0; + Object *collider = nullptr; + int shape = 0; }; virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) = 0; @@ -170,9 +170,9 @@ public: Vector3 position; Vector3 normal; RID rid; - ObjectID collider_id; - Object *collider; - int shape; + ObjectID collider_id = 0; + Object *collider = nullptr; + int shape = 0; }; virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false) = 0; @@ -184,8 +184,8 @@ public: Vector3 point; Vector3 normal; RID rid; - ObjectID collider_id; - int shape; + ObjectID collider_id = 0; + int shape = 0; Vector3 linear_velocity; //velocity at contact point };