I'm trying to change the engine so that each object can process time at a different speed. So far I've created a TimeBody that inherits body, and has an extra parameter called dilation, initially set to 1.0.
Within the PhysicsSystem I am going through Integrate and going to all the functions which pass dt (difference in time) and altering them so they call the functions, for each body, using dt multiplied by the new dilation variable.
The goal is to be able to change the dilation value dynamically, and have the objects work at different speeds relative to each other.
Do you think this could work, or would it take too much tweaking to do in this engine?
Issues I know that might come up are:
What happens when two objects with the same velocity collide as a result of different dilation? (this might work fine)
What happens when a negative dt is passed (I tried passing a negative in before modifications, it seems funky, I'll have to consider using an absolute value and flipping the velocities in these special cases)
Any advice would be great!
I've got a fair bit of algebra and calculus know-how, built simple 2D engines, this is the first time with a 3D engine, but I have 3D experience so it all makes pretty good sense to me.