Add a collider into the broad-phase collision detection
| 82 | |
| 83 | // Add a collider into the broad-phase collision detection |
| 84 | void BroadPhaseSystem::addCollider(Collider* collider, const AABB& aabb) { |
| 85 | |
| 86 | assert(collider->getBroadPhaseId() == -1); |
| 87 | |
| 88 | // Add the collision shape into the dynamic AABB tree and get its broad-phase ID |
| 89 | int nodeId = mDynamicAABBTree.addObject(aabb, collider); |
| 90 | |
| 91 | // Set the broad-phase ID of the collider |
| 92 | mCollidersComponents.setBroadPhaseId(collider->getEntity(), nodeId); |
| 93 | |
| 94 | // Add the collision shape into the array of bodies that have moved (or have been created) |
| 95 | // during the last simulation step |
| 96 | addMovedCollider(collider->getBroadPhaseId(), collider); |
| 97 | } |
| 98 | |
| 99 | // Remove a collider from the broad-phase collision detection |
| 100 | void BroadPhaseSystem::removeCollider(Collider* collider) { |
nothing calls this directly
no test coverage detected