Create and return a capsule shape * @param radius The radius of the sphere of the capsule shape * @param height The height of the capsule shape (distance betwen the two spheres centers) * @return boxShape A pointer to the created capsule shape */
| 370 | * @return boxShape A pointer to the created capsule shape |
| 371 | */ |
| 372 | CapsuleShape* PhysicsCommon::createCapsuleShape(decimal radius, decimal height) { |
| 373 | |
| 374 | if (radius <= decimal(0.0)) { |
| 375 | |
| 376 | RP3D_LOG("PhysicsCommon", Logger::Level::Error, Logger::Category::PhysicCommon, |
| 377 | "Error when creating a CapsuleShape: radius must be a positive value", __FILE__, __LINE__); |
| 378 | } |
| 379 | |
| 380 | if (height <= decimal(0.0)) { |
| 381 | |
| 382 | RP3D_LOG("PhysicsCommon", Logger::Level::Error, Logger::Category::PhysicCommon, |
| 383 | "Error when creating a CapsuleShape: height must be a positive value", __FILE__, __LINE__); |
| 384 | } |
| 385 | |
| 386 | CapsuleShape* shape = new (mMemoryManager.allocate(MemoryManager::AllocationType::Pool, sizeof(CapsuleShape))) CapsuleShape(radius, height, mMemoryManager.getHeapAllocator()); |
| 387 | |
| 388 | mCapsuleShapes.add(shape); |
| 389 | |
| 390 | return shape; |
| 391 | } |
| 392 | |
| 393 | // Destroy a capsule collision shape |
| 394 | /** |