Enable or disable the joints
| 361 | |
| 362 | // Enable or disable the joints |
| 363 | void PhysicsWorld::enableDisableJoints() { |
| 364 | |
| 365 | const uint32 nbJointComponents = mJointsComponents.getNbComponents(); |
| 366 | |
| 367 | Array<Entity> jointsEntites(mMemoryManager.getHeapAllocator(), nbJointComponents); |
| 368 | |
| 369 | // Get all the joints entities |
| 370 | for (uint32 i = 0; i < nbJointComponents; i++) { |
| 371 | jointsEntites.add(mJointsComponents.mJointEntities[i]); |
| 372 | } |
| 373 | |
| 374 | // For each joint |
| 375 | for (uint32 i = 0; i < nbJointComponents; i++) { |
| 376 | |
| 377 | uint32 jointEntityIndex = mJointsComponents.getEntityIndex(jointsEntites[i]); |
| 378 | |
| 379 | Entity body1 = mJointsComponents.mBody1Entities[jointEntityIndex]; |
| 380 | Entity body2 = mJointsComponents.mBody2Entities[jointEntityIndex]; |
| 381 | |
| 382 | // If both bodies of the joint are disabled |
| 383 | if (mBodyComponents.getIsEntityDisabled(body1) && mBodyComponents.getIsEntityDisabled(body2)) { |
| 384 | |
| 385 | // Disable the joint |
| 386 | setJointDisabled(jointsEntites[i], true); |
| 387 | } |
| 388 | else { |
| 389 | |
| 390 | // Enable the joint |
| 391 | setJointDisabled(jointsEntites[i], false); |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // Create a rigid body into the physics world |
| 397 | /** |
nothing calls this directly
no test coverage detected