Move and Rotate a point around a new origin
I'm trying to do something like this:
The pyramid is linked to the box. I have the positions and rotations of both the green box and the green pyramid. The axis intersecting the green box is at (0, 0, 0) with a rotation of (0, 0, 0). I want to move and rotate this group to the new axis centered in the purple box. I have the position and rotation of the purple box. What I need to know is how to calculate the new rotation and position of the red pyramid.
It's been quite a while since I've done stuff like this, so if someone could help me with formulas and how to use them to calculate the new rotation and position, I would appreciate it.
Here's an example if it would help:
Green box position: (0, 0, 0)
Green box rotation: (0, 0, 0)
Green pyramid position: (-24.81, 43.0345, 4)
Green pyramid rotation: (0, -0.22, 0.64)
Purple box position: (49.4771, 90.9461, 61.0026)
Purple box rotation: (-0.12217, -0.2967, 0.38397)
Red pyramid position: (?, ?, ?)
Red pyramid rotation: (?, ?, ?)
I'm working on this for a game.
If I use the mission editor, I can get the location and rotation of the red pyramid, and it is:
Red pyramid position: (10.6201, 120.922, 52.3397)
Red pyramid rotation: (-0.274722, -0.386207, 1.01696)
Unfortunately, there is no way to access the function the mission editor uses to rotate the group, so I need math formulas so I can manually do it.