diff options
Diffstat (limited to 'modules/bullet/space_bullet.cpp')
-rw-r--r-- | modules/bullet/space_bullet.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index b1ff418748..1659664ff9 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -108,7 +108,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V r_result.shape = btResult.m_shapeId; r_result.rid = gObj->get_self(); r_result.collider_id = gObj->get_instance_id(); - r_result.collider = r_result.collider_id.is_null() ? NULL : ObjectDB::get_instance(r_result.collider_id); + r_result.collider = r_result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(r_result.collider_id); } else { WARN_PRINT("The raycast performed has hit a collision object that is not part of Godot scene, please check it."); } @@ -309,7 +309,7 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_ btPointCollector result; btGjkPairDetector gjk_pair_detector(&point_shape, convex_shape, space->gjk_simplex_solver, space->gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(input, result, 0); + gjk_pair_detector.getClosestPoints(input, result, nullptr); if (out_distance > result.m_distance) { out_distance = result.m_distance; @@ -332,14 +332,14 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_ } SpaceBullet::SpaceBullet() : - broadphase(NULL), - collisionConfiguration(NULL), - dispatcher(NULL), - solver(NULL), - dynamicsWorld(NULL), - soft_body_world_info(NULL), - ghostPairCallback(NULL), - godotFilterCallback(NULL), + broadphase(nullptr), + collisionConfiguration(nullptr), + dispatcher(nullptr), + solver(nullptr), + dynamicsWorld(nullptr), + soft_body_world_info(nullptr), + ghostPairCallback(nullptr), + godotFilterCallback(nullptr), gravityDirection(0, -1, 0), gravityMagnitude(10), contactDebugCount(0), @@ -511,7 +511,7 @@ void SpaceBullet::remove_soft_body(SoftBodyBullet *p_body) { if (is_using_soft_world()) { if (p_body->get_bt_soft_body()) { static_cast<btSoftRigidDynamicsWorld *>(dynamicsWorld)->removeSoftBody(p_body->get_bt_soft_body()); - p_body->get_bt_soft_body()->m_worldInfo = NULL; + p_body->get_bt_soft_body()->m_worldInfo = nullptr; } } } @@ -539,7 +539,7 @@ void SpaceBullet::remove_all_collision_objects() { for (int i = dynamicsWorld->getNumCollisionObjects() - 1; 0 <= i; --i) { btCollisionObject *btObj = dynamicsWorld->getCollisionObjectArray()[i]; CollisionObjectBullet *colObj = static_cast<CollisionObjectBullet *>(btObj->getUserPointer()); - colObj->set_space(NULL); + colObj->set_space(nullptr); } } @@ -636,8 +636,8 @@ void SpaceBullet::destroy_world() { /// The world elements (like: Collision Objects, Constraints, Shapes) are managed by godot - dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(NULL); - dynamicsWorld->getPairCache()->setOverlapFilterCallback(NULL); + dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(nullptr); + dynamicsWorld->getPairCache()->setOverlapFilterCallback(nullptr); bulletdelete(ghostPairCallback); bulletdelete(godotFilterCallback); @@ -645,7 +645,7 @@ void SpaceBullet::destroy_world() { // Deallocate world dynamicsWorld->~btDiscreteDynamicsWorld(); free(dynamicsWorld); - dynamicsWorld = NULL; + dynamicsWorld = nullptr; bulletdelete(solver); bulletdelete(broadphase); @@ -741,7 +741,7 @@ void SpaceBullet::check_ghost_overlaps() { static_cast<btConvexShape *>(other_body_shape), gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); + gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr); if (0 >= result.m_distance) { hasOverlap = true; @@ -750,10 +750,10 @@ void SpaceBullet::check_ghost_overlaps() { } else { - btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y); - btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z); + btCollisionObjectWrapper obA(nullptr, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y); + btCollisionObjectWrapper obB(nullptr, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z); - btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS); + btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS); if (!algorithm) continue; @@ -885,8 +885,8 @@ void SpaceBullet::update_gravity() { #include "scene/3d/immediate_geometry.h" -static ImmediateGeometry3D *motionVec(NULL); -static ImmediateGeometry3D *normalLine(NULL); +static ImmediateGeometry3D *motionVec(nullptr); +static ImmediateGeometry3D *normalLine(nullptr); static Ref<StandardMaterial3D> red_mat; static Ref<StandardMaterial3D> blue_mat; #endif @@ -951,7 +951,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f Vector3 sup_line; B_TO_G(body_safe_position.getOrigin(), sup_line); motionVec->clear(); - motionVec->begin(Mesh::PRIMITIVE_LINES, NULL); + motionVec->begin(Mesh::PRIMITIVE_LINES, nullptr); motionVec->add_vertex(sup_line); motionVec->add_vertex(sup_line + p_motion * 10); motionVec->end(); @@ -1028,7 +1028,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f Vector3 sup_line2; B_TO_G(motion, sup_line2); normalLine->clear(); - normalLine->begin(Mesh::PRIMITIVE_LINES, NULL); + normalLine->begin(Mesh::PRIMITIVE_LINES, nullptr); normalLine->add_vertex(r_result->collision_point); normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10); normalLine->end(); @@ -1124,7 +1124,7 @@ public: if (cs->getNumChildShapes() > 1) { const btDbvt *tree = cs->getDynamicAabbTree(); - ERR_FAIL_COND_V(tree == NULL, true); + ERR_FAIL_COND_V(tree == nullptr, true); // Transform bounds into compound shape local space const btTransform other_in_compound_space = co->getWorldTransform().inverse(); @@ -1275,7 +1275,7 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt // Perform GJK test btPointCollector result; btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); + gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr); if (0 > result.m_distance) { // Has penetration r_delta_recover_movement += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale); @@ -1302,10 +1302,10 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC btTransform tA(p_transformA); - btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A); - btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); + btCollisionObjectWrapper obA(nullptr, p_shapeA, p_objectA, tA, -1, p_shapeId_A); + btCollisionObjectWrapper obB(nullptr, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); - btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS); + btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS); if (algorithm) { GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB); //discrete collision detection query |