MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / createChainCollisionShape

Method createChainCollisionShape

engine/source/2d/sceneobject/SceneObject.cc:2470–2504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2468//-----------------------------------------------------------------------------
2469
2470S32 SceneObject::createChainCollisionShape( const U32 pointCount, const b2Vec2* localPoints )
2471{
2472 // Debug Profiling.
2473 PROFILE_SCOPE(SceneObject_CreateChainCollisionShape);
2474
2475 // Sanity!
2476 if ( pointCount < 2 )
2477 {
2478 Con::errorf("SceneObject::createChainCollisionShape() - Invalid point count of %d.", pointCount);
2479 return -1;
2480 }
2481
2482 // Configure fixture definition.
2483 b2FixtureDef* pFixtureDef = new b2FixtureDef( mDefaultFixture );
2484 b2ChainShape* pShape = new b2ChainShape();
2485 pShape->CreateChain( localPoints, pointCount );
2486 pFixtureDef->shape = pShape;
2487
2488 if ( mpScene )
2489 {
2490 // Create and push fixture.
2491 mCollisionFixtures.push_back( mpBody->CreateFixture( pFixtureDef ) );
2492
2493 // Destroy shape and fixture.
2494 delete pShape;
2495 delete pFixtureDef;
2496
2497 return mCollisionFixtures.size()-1;
2498 }
2499
2500 // Push fixture definition.
2501 mCollisionFixtureDefs.push_back( pFixtureDef );
2502
2503 return mCollisionFixtureDefs.size()-1;
2504}
2505
2506//-----------------------------------------------------------------------------
2507

Callers 2

Calls 7

errorfFunction · 0.85
CreateChainMethod · 0.80
CreateFixtureMethod · 0.80
SetPrevVertexMethod · 0.80
SetNextVertexMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected