| 838 | |
| 839 | #ifdef PLATFORMS_AS_OBSTACLES |
| 840 | void SampleBridges::updateRenderPlatforms(float dtime) |
| 841 | { |
| 842 | // PT: compute new positions for (render) platforms, then move their corresponding obstacles to these positions. |
| 843 | const PxU32 nbPlatforms = mPlatformManager.getNbPlatforms(); |
| 844 | KinematicPlatform** platforms = mPlatformManager.getPlatforms(); |
| 845 | |
| 846 | { |
| 847 | PxSceneReadLock scopedLock(*mScene); |
| 848 | |
| 849 | for(PxU32 i=0;i<nbPlatforms;i++) |
| 850 | { |
| 851 | if(1) |
| 852 | { |
| 853 | PxRigidDynamic* actor = platforms[i]->getPhysicsActor(); |
| 854 | PxShape* shape = NULL; |
| 855 | actor->getShapes(&shape, 1); |
| 856 | RenderBaseActor* renderActor = getRenderActor(actor, shape); |
| 857 | renderActor->setTransform(platforms[i]->getRenderPose()); |
| 858 | } |
| 859 | |
| 860 | platforms[i]->updateRender(dtime, mObstacleContext); |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | // PT: if render time & physics time varies too much, we must resync the physics to avoid large visual mismatchs |
| 865 | if(mMustResync) |
| 866 | { |
| 867 | PxSceneWriteLock scopedLock(*mScene); |
| 868 | |
| 869 | // mElapsedPlatformTime = mElapsedRenderTime; |
| 870 | mPlatformManager.syncElapsedTime(mElapsedRenderTime); |
| 871 | // static int count=0; shdfnd::printFormatted("Resync %d\n", count++); |
| 872 | for(PxU32 i=0;i<nbPlatforms;i++) |
| 873 | { |
| 874 | PxRigidDynamic* actor = platforms[i]->getPhysicsActor(); |
| 875 | actor->setKinematicTarget(platforms[i]->getRenderPose()); |
| 876 | platforms[i]->resync(); |
| 877 | } |
| 878 | } |
| 879 | } |
| 880 | #endif |
| 881 | |
| 882 | /////////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected