vm6502q/OpenRelativity

PhysX tangent space mechanics

Closed this issue · 2 comments

I'm sure the original OpenRelativity team would recognize that this this fork has had some significant success with co-opting PhysX collision solving, for supporting relativistic collision. The basic assumption is that PhysX already satisfies "rapidity" based mechanics in the local "tangent space."

(By "rapidity," I mean linear integral of proper acceleration, rather than hyperbolic, such that rapidity approaching infinite magnitude limits to a speed-of-light velocity: https://en.wikipedia.org/wiki/Rapidity)

PhysX' assumptions, if "classically mechanical," are those of "rapidity mechanics" "tangent spaces." We should offload "mechanics" simulation to PhysX under this assumption, by a cycle of loading a Rigidbody with quantities transformed to the local tangent space, and transforming back after physics update.

I think all it takes to add this is 50b9c14. (We've been unconsciously driving towards it for a long time.)

This doesn't immediately fully work with RindlerGravity, or maybe very hyper-relativistic scenarios, but it's better than anything we can reinvent redundantly in RelativisticObject, for now.

On FixedUpdate(), a RelativisticObject loads its Rigidbody with appropriately transformed velocity and angular velocity. FixedUpdate() also sets a flag to let the downstream lifecycle know that it expects an immediate internal physics update, by PhysX.

The next available opportunity to (inverse) transform the "rapidity" "tangent space" physics update into RelativisticObject state, downstream in the lifecycle immediately after internal physics update, is in Update(). If Update() sees that FixedUpdate() has set the update flag, (meaning that an internal physics updates has definitely just happened, by the time we've arrived at Update() with the flag set,) then it inversely transforms the PhysX Rigidbody state update back into RelativisticObject state.

If a collision happens, in the meantime, this will happen before Update() in the same cycle; we inverse transform the quantities on collision and clear the physics update flag from FixedUpdate() before we reach Update().

(That's it!)

We still need handling for piw updates via PhysX.