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

Method createSphereShape

src/engine/PhysicsCommon.cpp:271–283  ·  view source on GitHub ↗

Create and return a sphere collision shape * @param radius The radius of the sphere collision shape * @return A pointer to the created sphere shape */

Source from the content-addressed store, hash-verified

269 * @return A pointer to the created sphere shape
270 */
271SphereShape* PhysicsCommon::createSphereShape(const decimal radius) {
272
273 if (radius <= decimal(0.0)) {
274
275 RP3D_LOG("PhysicsCommon", Logger::Level::Error, Logger::Category::PhysicCommon,
276 "Error when creating a SphereShape: radius must be a positive value", __FILE__, __LINE__);
277 }
278
279 SphereShape* shape = new (mMemoryManager.allocate(MemoryManager::AllocationType::Pool, sizeof(SphereShape))) SphereShape(radius, mMemoryManager.getHeapAllocator());
280 mSphereShapes.add(shape);
281
282 return shape;
283}
284
285// Destroy a sphere collision shape
286/**

Callers 6

TestRigidBodyMethod · 0.80
TestPointInsideMethod · 0.80
TestRaycastMethod · 0.80
TestWorldQueriesMethod · 0.80
DumbbellMethod · 0.80
SphereMethod · 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