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

Method onSubstep

physx/samples/samplecustomgravity/SampleCustomGravity.cpp:410–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410void SampleCustomGravity::onSubstep(float dtime)
411{
412 mPlatformManager.updatePhysicsPlatforms(dtime);
413
414 PxSceneWriteLock scopedLock(*mScene);
415
416 PxU32 nb = (PxU32)mDebugActors.size();
417 for(PxU32 i=0;i<nb;i++)
418 {
419 PxRigidDynamic* dyna = mDebugActors[i];
420 // Don't accumulate forces in sleeping objects, else they explode when waking up
421 if(dyna->isSleeping())
422 continue;
423
424 PxTransform pose = dyna->getGlobalPose();
425
426 PxVec3 up;
427 mPlanet.getUpVector(up, pose.p);
428
429// const PxVec3 force = -up * 9.81f;
430// const PxVec3 force = -up * 9.81f * 0.25f;
431 const PxVec3 force = -up * 9.81f * 4.0f;
432// const PxVec3 force = -up * 9.81f * 10.0f;
433
434 dyna->addForce(force, PxForceMode::eACCELERATION, false);
435// dyna->addForce(force, PxForceMode::eIMPULSE);
436 }
437}
438
439
440void SampleCustomGravity::onPointerInputEvent(const SampleFramework::InputEvent& ie, physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, bool val)

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.45
isSleepingMethod · 0.45
getGlobalPoseMethod · 0.45
getUpVectorMethod · 0.45
addForceMethod · 0.45

Tested by

no test coverage detected