MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / createBoxShape

Method createBoxShape

src/engine/PhysicsCommon.cpp:321–333  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

319 * @return A pointer to the created box shape
320 */
321BoxShape* 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/**

Callers 5

TestRigidBodyMethod · 0.80
TestPointInsideMethod · 0.80
TestRaycastMethod · 0.80
TestWorldQueriesMethod · 0.80
BoxMethod · 0.80

Calls 2

allocateMethod · 0.45
addMethod · 0.45

Tested by 4

TestRigidBodyMethod · 0.64
TestPointInsideMethod · 0.64
TestRaycastMethod · 0.64
TestWorldQueriesMethod · 0.64