summaryrefslogtreecommitdiff
path: root/modules/bullet
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet')
-rw-r--r--modules/bullet/area_bullet.h10
-rw-r--r--modules/bullet/btRayShape.cpp4
-rw-r--r--modules/bullet/btRayShape.h6
-rw-r--r--modules/bullet/collision_object_bullet.h2
-rw-r--r--modules/bullet/godot_motion_state.h2
-rw-r--r--modules/bullet/godot_ray_world_algorithm.h2
-rw-r--r--modules/bullet/godot_result_callbacks.h38
-rw-r--r--modules/bullet/rid_bullet.h2
-rw-r--r--modules/bullet/rigid_body_bullet.h22
-rw-r--r--modules/bullet/shape_bullet.h10
-rw-r--r--modules/bullet/soft_body_bullet.h2
-rw-r--r--modules/bullet/space_bullet.cpp12
-rw-r--r--modules/bullet/space_bullet.h6
13 files changed, 58 insertions, 60 deletions
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index a5fa678fec..7cf666c119 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -80,18 +80,18 @@ public:
private:
// These are used by function callEvent. Instead to create this each call I create if one time.
Variant call_event_res[5];
- Variant *call_event_res_ptr[5];
+ Variant *call_event_res_ptr[5] = {};
- btGhostObject *btGhost;
+ btGhostObject *btGhost = nullptr;
Vector<OverlappingObjectData> overlappingObjects;
bool monitorable = true;
PhysicsServer3D::AreaSpaceOverrideMode spOv_mode = PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
bool spOv_gravityPoint = false;
- real_t spOv_gravityPointDistanceScale = 0;
- real_t spOv_gravityPointAttenuation = 1;
+ real_t spOv_gravityPointDistanceScale = 0.0;
+ real_t spOv_gravityPointAttenuation = 1.0;
Vector3 spOv_gravityVec = Vector3(0, -1, 0);
- real_t spOv_gravityMag = 10;
+ real_t spOv_gravityMag = 10.0;
real_t spOv_linearDump = 0.1;
real_t spOv_angularDump = 0.1;
int spOv_priority = 0;
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index 1568cca63d..109854c9dd 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -39,11 +39,9 @@
*/
btRayShape::btRayShape(btScalar length) :
- btConvexInternalShape(),
- m_shapeAxis(0, 0, 1) {
+ btConvexInternalShape() {
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
setLength(length);
- slipsOnSlope = false;
}
btRayShape::~btRayShape() {
diff --git a/modules/bullet/btRayShape.h b/modules/bullet/btRayShape.h
index dcc4cc79c7..330755aa31 100644
--- a/modules/bullet/btRayShape.h
+++ b/modules/bullet/btRayShape.h
@@ -42,10 +42,10 @@
/// Ray shape around z axis
ATTRIBUTE_ALIGNED16(class)
btRayShape : public btConvexInternalShape {
- btScalar m_length;
- bool slipsOnSlope;
+ btScalar m_length = 0;
+ bool slipsOnSlope = false;
/// The default axis is the z
- btVector3 m_shapeAxis;
+ btVector3 m_shapeAxis = btVector3(0, 0, 1);
btTransform m_cacheSupportPoint;
btScalar m_cacheScaledLength;
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index bea28f2183..c8081a53f1 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -110,7 +110,7 @@ public:
};
protected:
- Type type;
+ Type type = TYPE_AREA;
ObjectID instance_id;
uint32_t collisionLayer = 0;
uint32_t collisionMask = 0;
diff --git a/modules/bullet/godot_motion_state.h b/modules/bullet/godot_motion_state.h
index 0669d2739a..ca17349130 100644
--- a/modules/bullet/godot_motion_state.h
+++ b/modules/bullet/godot_motion_state.h
@@ -51,7 +51,7 @@ class GodotMotionState : public btMotionState {
/// This data is used to store last world position
btTransform bodyCurrentWorldTransform;
- RigidBodyBullet *owner;
+ RigidBodyBullet *owner = nullptr;
public:
GodotMotionState(RigidBodyBullet *p_owner) :
diff --git a/modules/bullet/godot_ray_world_algorithm.h b/modules/bullet/godot_ray_world_algorithm.h
index f705edef81..25798aecb4 100644
--- a/modules/bullet/godot_ray_world_algorithm.h
+++ b/modules/bullet/godot_ray_world_algorithm.h
@@ -45,7 +45,7 @@ class GodotRayWorldAlgorithm : public btActivatingCollisionAlgorithm {
const btDiscreteDynamicsWorld *m_world;
btPersistentManifold *m_manifoldPtr;
bool m_ownManifold = false;
- bool m_isSwapped;
+ bool m_isSwapped = false;
public:
GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped);
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index 4f40f7ecfd..f92665f3e4 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -59,8 +59,8 @@ struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResult
bool m_pickRay = false;
int m_shapeId = 0;
- bool collide_with_bodies;
- bool collide_with_areas;
+ bool collide_with_bodies = false;
+ bool collide_with_areas = false;
public:
GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
@@ -84,8 +84,8 @@ public:
// store all colliding object
struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback {
public:
- PhysicsDirectSpaceState3D::ShapeResult *m_results;
- int m_resultMax;
+ PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
+ int m_resultMax = 0;
const Set<RID> *m_exclude;
int count = 0;
@@ -117,8 +117,8 @@ public:
const Set<RID> *m_exclude;
int m_shapeId = 0;
- bool collide_with_bodies;
- bool collide_with_areas;
+ bool collide_with_bodies = false;
+ bool collide_with_areas = false;
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
@@ -134,13 +134,13 @@ public:
struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
- PhysicsDirectSpaceState3D::ShapeResult *m_results;
- int m_resultMax;
+ PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
+ int m_resultMax = 0;
const Set<RID> *m_exclude;
int m_count = 0;
- bool collide_with_bodies;
- bool collide_with_areas;
+ bool collide_with_bodies = false;
+ bool collide_with_areas = false;
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),
@@ -159,13 +159,13 @@ public:
struct GodotContactPairContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
- Vector3 *m_results;
- int m_resultMax;
+ Vector3 *m_results = nullptr;
+ int m_resultMax = 0;
const Set<RID> *m_exclude;
int m_count = 0;
- bool collide_with_bodies;
- bool collide_with_areas;
+ bool collide_with_bodies = false;
+ bool collide_with_areas = false;
GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),
@@ -183,14 +183,14 @@ public:
struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
- PhysicsDirectSpaceState3D::ShapeRestInfo *m_result;
+ PhysicsDirectSpaceState3D::ShapeRestInfo *m_result = nullptr;
const Set<RID> *m_exclude;
bool m_collided = false;
- real_t m_min_distance = 0;
- const btCollisionObject *m_rest_info_collision_object;
+ real_t m_min_distance = 0.0;
+ const btCollisionObject *m_rest_info_collision_object = nullptr;
btVector3 m_rest_info_bt_point;
- bool collide_with_bodies;
- bool collide_with_areas;
+ bool collide_with_bodies = false;
+ bool collide_with_areas = false;
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),
diff --git a/modules/bullet/rid_bullet.h b/modules/bullet/rid_bullet.h
index 0b74a0cc4d..face6b4861 100644
--- a/modules/bullet/rid_bullet.h
+++ b/modules/bullet/rid_bullet.h
@@ -41,7 +41,7 @@ class BulletPhysicsServer3D;
class RIDBullet {
RID self;
- BulletPhysicsServer3D *physicsServer;
+ BulletPhysicsServer3D *physicsServer = nullptr;
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index 57b80cf50c..a4be7f9e07 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -81,8 +81,8 @@ public:
}
public:
- RigidBodyBullet *body;
- real_t deltaTime;
+ RigidBodyBullet *body = nullptr;
+ real_t deltaTime = 0.0;
private:
BulletPhysicsDirectBodyState3D() {}
@@ -144,13 +144,13 @@ public:
class RigidBodyBullet : public RigidCollisionObjectBullet {
public:
struct CollisionData {
- RigidBodyBullet *otherObject;
- int other_object_shape;
- int local_shape;
+ RigidBodyBullet *otherObject = nullptr;
+ int other_object_shape = 0;
+ int local_shape = 0;
Vector3 hitLocalLocation;
Vector3 hitWorldLocation;
Vector3 hitNormal;
- real_t appliedImpulse;
+ real_t appliedImpulse = 0.0;
};
struct ForceIntegrationCallback {
@@ -169,7 +169,7 @@ public:
};
struct KinematicUtilities {
- RigidBodyBullet *owner;
+ RigidBodyBullet *owner = nullptr;
btScalar safe_margin;
Vector<KinematicShape> shapes;
@@ -194,10 +194,10 @@ private:
GodotMotionState *godotMotionState;
btRigidBody *btBody;
uint16_t locked_axis = 0;
- real_t mass = 1;
- real_t gravity_scale = 1;
- real_t linearDamp = 0;
- real_t angularDamp = 0;
+ real_t mass = 1.0;
+ real_t gravity_scale = 1.0;
+ real_t linearDamp = 0.0;
+ real_t angularDamp = 0.0;
bool can_sleep = true;
bool omit_forces_integration = false;
bool can_integrate_forces = false;
diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h
index 63475822de..bfd95747eb 100644
--- a/modules/bullet/shape_bullet.h
+++ b/modules/bullet/shape_bullet.h
@@ -213,10 +213,10 @@ private:
class HeightMapShapeBullet : public ShapeBullet {
public:
Vector<real_t> heights;
- int width;
- int depth;
- real_t min_height;
- real_t max_height;
+ int width = 0;
+ int depth = 0;
+ real_t min_height = 0.0;
+ real_t max_height = 0.0;
HeightMapShapeBullet();
@@ -231,7 +231,7 @@ private:
class RayShapeBullet : public ShapeBullet {
public:
- real_t length = 1;
+ real_t length = 1.0;
bool slips_on_slope = false;
RayShapeBullet();
diff --git a/modules/bullet/soft_body_bullet.h b/modules/bullet/soft_body_bullet.h
index b15b72daf9..564566d8b8 100644
--- a/modules/bullet/soft_body_bullet.h
+++ b/modules/bullet/soft_body_bullet.h
@@ -59,7 +59,7 @@ class SoftBodyBullet : public CollisionObjectBullet {
private:
btSoftBody *bt_soft_body = nullptr;
Vector<Vector<int>> indices_table;
- btSoftBody::Material *mat0; // This is just a copy of pointer managed by btSoftBody
+ btSoftBody::Material *mat0 = nullptr; // This is just a copy of pointer managed by btSoftBody
bool isScratched = false;
Ref<Mesh> soft_mesh;
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 79a5fdb3d2..7d337bc4d0 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -1092,13 +1092,13 @@ private:
btDbvtVolume bounds;
const btCollisionObject *self_collision_object;
- uint32_t collision_layer;
- uint32_t collision_mask;
+ uint32_t collision_layer = 0;
+ uint32_t collision_mask = 0;
struct CompoundLeafCallback : btDbvt::ICollide {
private:
- RecoverPenetrationBroadPhaseCallback *parent_callback;
- btCollisionObject *collision_object;
+ RecoverPenetrationBroadPhaseCallback *parent_callback = nullptr;
+ btCollisionObject *collision_object = nullptr;
public:
CompoundLeafCallback(RecoverPenetrationBroadPhaseCallback *p_parent_callback, btCollisionObject *p_collision_object) :
@@ -1116,8 +1116,8 @@ private:
public:
struct BroadphaseResult {
- btCollisionObject *collision_object;
- int compound_child_index;
+ btCollisionObject *collision_object = nullptr;
+ int compound_child_index = 0;
};
Vector<BroadphaseResult> results;
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index 1caa3c2a0c..87aa2b9e93 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -100,12 +100,12 @@ class SpaceBullet : public RIDBullet {
btGhostPairCallback *ghostPairCallback = nullptr;
GodotFilterCallback *godotFilterCallback = nullptr;
- btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver;
- btVoronoiSimplexSolver *gjk_simplex_solver;
+ btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver = nullptr;
+ btVoronoiSimplexSolver *gjk_simplex_solver = nullptr;
BulletPhysicsDirectSpaceState *direct_access;
Vector3 gravityDirection = Vector3(0, -1, 0);
- real_t gravityMagnitude = 10;
+ real_t gravityMagnitude = 10.0;
real_t linear_damp = 0.0;
real_t angular_damp = 0.0;