| 408 | } |
| 409 | |
| 410 | void 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 | |
| 440 | void SampleCustomGravity::onPointerInputEvent(const SampleFramework::InputEvent& ie, physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, bool val) |
nothing calls this directly
no test coverage detected