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

Method onTickPreRender

physx/samples/samplevehicle/SampleVehicle.cpp:576–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574
575
576void SampleVehicle::onTickPreRender(PxF32 dtime)
577{
578 mScene->lockWrite();
579 if(mFixCar)
580 {
581 //Get the transform of the last crossed waypoint and reset the player car
582 //at this transform.
583 resetFocusVehicleAtWaypoint();
584 mFixCar=false;
585 //Reset the control logic driving the car back to start state to avoid mismatch
586 //between vehicle gears and state stored in vehicle controller.
587 mVehicleController.clear();
588#if PX_DEBUG_VEHICLE_ON
589 //Clear all the graph data because the discontinuity in car position makes the stored data redundant.
590 clearTelemetryData();
591#endif
592 }
593 else if(mBackToStart)
594 {
595 //Set the progress back to zero.
596 mWayPoints.setBackAtStart();
597 //Get the transform of the last crossed waypoint (this will now be the start
598 //waypoint) and reset the player car at this transform.
599 resetFocusVehicleAtWaypoint();
600 mBackToStart=false;
601 //Reset the control logic driving the car back to start state to avoid mismatch
602 //between vehicle gears and state stored in vehicle controller.
603 mVehicleController.clear();
604#if PX_DEBUG_VEHICLE_ON
605 //Clear all the graph data because the discontinuity in car position makes the stored data redundant.
606 clearTelemetryData();
607#endif
608 }
609
610 //Only switch to 3-wheeled if driving a 4-wheeled car.
611 if(ePLAYER_VEHICLE_TYPE_VEHICLE4W==mPlayerVehicleType)
612 {
613 if(m3WModeIncremented)
614 {
615 const PxU32 old3WMode=m3WMode;
616 const PxU32 new3WMode=(m3WMode+1)%3;
617 if(0==old3WMode && 1==new3WMode)
618 {
619 mVehicleManager.switchTo3WDeltaMode(mPlayerVehicle);
620 }
621 else if(1==old3WMode && 2==new3WMode)
622 {
623 mVehicleManager.switchTo3WTadpoleMode(mPlayerVehicle);
624 }
625 else if(2==old3WMode && 0==new3WMode)
626 {
627 mVehicleManager.switchTo4WMode(mPlayerVehicle);
628 }
629 m3WModeIncremented=false;
630 m3WMode=new3WMode;
631 }
632 }
633

Callers

nothing calls this directly

Calls 15

lockWriteMethod · 0.80
setBackAtStartMethod · 0.80
switchTo3WDeltaModeMethod · 0.80
switchTo3WTadpoleModeMethod · 0.80
switchTo4WModeMethod · 0.80
getRigidDynamicActorMethod · 0.80
setTransformMethod · 0.80
setWorldBoundsMethod · 0.80
lookAtMethod · 0.80
unlockWriteMethod · 0.80
clearMethod · 0.45
setInputsMethod · 0.45

Tested by

no test coverage detected