Create and return a box collision shape * @param halfExtents A vector with the three half-extents of the box shape * @return A pointer to the created box shape */
| 319 | * @return A pointer to the created box shape |
| 320 | */ |
| 321 | BoxShape* PhysicsCommon::createBoxShape(const Vector3& halfExtents) { |
| 322 | |
| 323 | if (halfExtents.x <= decimal(0.0) || halfExtents.y <= decimal(0.0) || halfExtents.z <= decimal(0.0)) { |
| 324 | |
| 325 | RP3D_LOG("PhysicsCommon", Logger::Level::Error, Logger::Category::PhysicCommon, |
| 326 | "Error when creating a BoxShape: the half extents must be positive values", __FILE__, __LINE__); |
| 327 | } |
| 328 | BoxShape* shape = new (mMemoryManager.allocate(MemoryManager::AllocationType::Pool, sizeof(BoxShape))) BoxShape(halfExtents, mMemoryManager.getHeapAllocator(), *this); |
| 329 | |
| 330 | mBoxShapes.add(shape); |
| 331 | |
| 332 | return shape; |
| 333 | } |
| 334 | |
| 335 | // Destroy a box collision shape |
| 336 | /** |