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

Method tryStandup

physx/samples/samplecctsharedcode/SampleCCTActor.cpp:212–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void ControlledActor::tryStandup()
213{
214 // overlap with upper part
215 if(mType==PxControllerShapeType::eBOX)
216 {
217 }
218 else if(mType==PxControllerShapeType::eCAPSULE)
219 {
220 PxScene* scene = mController->getScene();
221 PxSceneReadLock scopedLock(*scene);
222
223 PxCapsuleController* capsuleCtrl = static_cast<PxCapsuleController*>(mController);
224
225 PxReal r = capsuleCtrl->getRadius();
226 PxReal dh = mStandingSize - mCrouchingSize-2*r;
227 PxCapsuleGeometry geom(r, dh*.5f);
228
229 PxExtendedVec3 position = mController->getPosition();
230 PxVec3 pos((float)position.x,(float)position.y+mStandingSize*.5f+r,(float)position.z);
231 PxQuat orientation(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f));
232
233 PxOverlapBuffer hit;
234 if(scene->overlap(geom, PxTransform(pos,orientation), hit, PxQueryFilterData(PxQueryFlag::eANY_HIT|PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC)))
235 return;
236 }
237
238 // if no hit, we can stand up
239 resizeStanding();
240
241 mDoStandup = false;
242 mIsCrouching = false;
243}
244
245void ControlledActor::resizeController(PxReal height)
246{

Callers

nothing calls this directly

Calls 7

PxQueryFilterDataClass · 0.85
getRadiusMethod · 0.80
PxVec3Class · 0.50
PxTransformClass · 0.50
getSceneMethod · 0.45
getPositionMethod · 0.45
overlapMethod · 0.45

Tested by

no test coverage detected