Notify the world if a body is disabled (sleeping) or not
| 166 | |
| 167 | // Notify the world if a body is disabled (sleeping) or not |
| 168 | void PhysicsWorld::setBodyDisabled(Entity bodyEntity, bool isDisabled) { |
| 169 | |
| 170 | if (isDisabled == mBodyComponents.getIsEntityDisabled(bodyEntity)) return; |
| 171 | |
| 172 | // Notify all the components |
| 173 | mBodyComponents.setIsEntityDisabled(bodyEntity, isDisabled); |
| 174 | mTransformComponents.setIsEntityDisabled(bodyEntity, isDisabled); |
| 175 | |
| 176 | assert(mRigidBodyComponents.hasComponent(bodyEntity)); |
| 177 | |
| 178 | mRigidBodyComponents.setIsEntityDisabled(bodyEntity, isDisabled); |
| 179 | |
| 180 | // For each collider of the body |
| 181 | const Array<Entity>& collidersEntities = mBodyComponents.getColliders(bodyEntity); |
| 182 | const uint32 nbColliderEntities = static_cast<uint32>(collidersEntities.size()); |
| 183 | for (uint32 i=0; i < nbColliderEntities; i++) { |
| 184 | mCollidersComponents.setIsEntityDisabled(collidersEntities[i], isDisabled); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | // Notify the world whether a joint is disabled or not |
| 189 | void PhysicsWorld::setJointDisabled(Entity jointEntity, bool isDisabled) { |
no test coverage detected