MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / GenerateCompound

Function GenerateCompound

physx/samples/samplebase/PhysXSample.cpp:262–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260#endif
261
262static PxRigidDynamic* GenerateCompound(PxPhysics& sdk, PxScene* scene, PxMaterial* defaultMat, const PxVec3& pos, const PxQuat& rot, const std::vector<PxTransform>& poses, const std::vector<const PxGeometry*>& geometries, bool kinematic=false, PxReal density = 1.0f)
263{
264 PxRigidDynamic* actor = sdk.createRigidDynamic(PxTransform(pos, rot));
265 SetupDefaultRigidDynamic(*actor);
266
267 PX_ASSERT(poses.size() == geometries.size());
268 for(PxU32 i=0;i<poses.size();i++)
269 {
270 const PxTransform& currentPose = poses[i];
271 const PxGeometry* currentGeom = geometries[i];
272
273 PxShape* shape = PxRigidActorExt::createExclusiveShape(*actor, *currentGeom, *defaultMat);
274 shape->setLocalPose(currentPose);
275 PX_ASSERT(shape);
276 }
277
278 if(actor)
279 {
280 PxRigidBodyExt::updateMassAndInertia(*actor, density);
281 scene->addActor(*actor);
282 }
283 return actor;
284}
285
286//////////////////////////////////////////////////////////////////////////
287

Callers 1

createCompoundMethod · 0.85

Calls 7

SetupDefaultRigidDynamicFunction · 0.85
updateMassAndInertiaFunction · 0.85
PxTransformClass · 0.50
createRigidDynamicMethod · 0.45
sizeMethod · 0.45
setLocalPoseMethod · 0.45
addActorMethod · 0.45

Tested by

no test coverage detected