I am working in a game. I have a spaceship which can accelerate in any direction and can rotate around any axis (in 3D space). I want to have all other bodies in the world remain in exactly the same position relative to the ship, regardless of the ship's acceleration and rotation.
The acceleration part was easy: I calculated the change in velocity on every tick and added it to the other bodies. Rotation, though, is giving me headaches. I am not sure how to approach this. I have the ship's world matrix, and it has Up, Front, Back, Left, Right, Down vectors. I also use the center of mass of everything in the calculations.
How would I calculate a new position for every body, so that, when the ship rotates, they remain in the same relative spot?