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

Function createRigidActor

physx/samples/samplebridges/SampleBridges.cpp:127–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125// PT: TODO: use PhysXSampleApplication helper for this
126
127static PxRigidActor* createRigidActor( PxScene& scene, PxPhysics& physics,
128 const PxTransform& pose, const PxGeometry& geometry, PxMaterial& material,
129 const PxFilterData* fd, const PxReal* density, const PxReal* mass, PxU32 flags)
130{
131 const bool isDynamic = (density && *density) || (mass && *mass);
132
133 PxRigidActor* actor = isDynamic ? static_cast<PxRigidActor*>(physics.createRigidDynamic(pose))
134 : static_cast<PxRigidActor*>(physics.createRigidStatic(pose));
135 if(!actor)
136 return NULL;
137
138 PxShape* shape = PxRigidActorExt::createExclusiveShape(*actor, geometry, material);
139 if(!shape)
140 {
141 actor->release();
142 return NULL;
143 }
144
145 if(fd)
146 shape->setSimulationFilterData(*fd);
147
148 if(isDynamic)
149 {
150 PxRigidDynamic* body = static_cast<PxRigidDynamic*>(actor);
151 {
152 if(density)
153 PxRigidBodyExt::updateMassAndInertia(*body, *density);
154 else
155 PxRigidBodyExt::setMassAndUpdateInertia(*body, *mass);
156 }
157 }
158
159 scene.addActor(*actor);
160
161 return actor;
162}
163
164static PxRigidActor* createBox( PxScene& scene, PxPhysics& physics,
165 const PxTransform& pose, const PxVec3& dimensions, const PxReal density, PxMaterial& m, const PxFilterData* fd, PxU32 flags)

Callers 1

createBoxFunction · 0.70

Calls 7

updateMassAndInertiaFunction · 0.85
setMassAndUpdateInertiaFunction · 0.85
createRigidDynamicMethod · 0.45
createRigidStaticMethod · 0.45
releaseMethod · 0.45
addActorMethod · 0.45

Tested by

no test coverage detected