currently my 2D rigidbody physics system uses world-space positions/rotations for mostly everything, even the contact points are in world-space.
It works fine, but i think its not good for performance to have everything in world-space and to transform all the bodies*vertices for each frame. Therefore i want to know, what is the fastest way to transform one bodys space into another bodys space.
My thought about that is that i treat one body A (The reference body) as static without any rotation at all and transform the other body (incident body B) into that space like this:
Offset position for bodyA = position of body B - postion of body A
Offset rotation for bodyA = rotation of body B - rotation of body A
Then i just add the offsets to bodyA position and rotation - and calculate separating axis, support points, contact points, all that stuff and leave it in that local space. After that, the contact manifold+points must be converted back into the space of the incident body - would this work, or is there some better way?