Hi,
I am new to the world of programming, so forgive such a question, but how would a developer disable the realtime aspect of NVIDIA PHYSX in order to do a pre-rendered cutscene with a fixed FPS, with said cutscene being developed with the same software? I just can’t find out how to control the clock.
PhysX doesn’t have any code that specifically makes it run in real-time. It is entirely up to the developer to use the PhysX api as required if they want simulation time to track graphics time.
PhysX has a function PxScene::Simulate, which takes the timestep as a function argument. The timestep can vary each frame or it can be a fixed step. Typically, game developers call PhysX with a timestep in the range 1/60 seconds to 1/30 seconds. I would generally recommend using a fixed step because it produces deterministic behaviour.
Tthe game loop always has a sense of how much real time has passed since physx was last simulated. If a fixed simulation timestep is used then the developer needs to keep a track of simulation time so that physx can be advanced forward by N fixed size steps until it is ahead of real time. Some developers interpolate between two simulation frames (one behind real time, one ahead of real time) to compute transforms at the desired time. That isn’t alwasy necessary. The alternative is to use a variable timestep for PhysX. I don’t personally recommend that but many developers do use variable simulation steps. Again, the game loop knows how much time has passed and can just pass that time to the physx simulation function. There’s a problem if a lot of time has passed and physx is then advanced with a large simulation time. That can lead to instabilities. The solution is to have a maximum simulation time and then to divide the advancement of physx each frame into N smaller steps.
Cheers,
Gordon
THANK YOU MAN!!!