Repeatedly, for any angle of rotation and any position.
Thanks for your help so far.
Are you going to have to do these computations at run-time, or can you get away with doing it at edit time? I guess where I'm going with this is this: you're not going to want to do all these computations by hand. You're going to want to set up a function, maybe, to do these computations for you.
It will be run through a function, so that it can be applied to every map. We have a list of positions and rotations for about 150 antennas, and the function will go through all of them and calculate the changes that need to be applied. Each map has the bases in different rotations and positions, so it has to be fully automated. The function will be run at the start of the mission, and spawn them all.
This problem is starting to annoy me. Every time I think I've got my mind wrapped around it, and I know what to do, something comes up and confuses me. This is why I haven't been able to give you one nice, big post with all the operations necessary. What's confusing me right now is this: why, when the original green box has no rotation, does the green pyramid have rotations about more than one axis? Let's say that the pyramid is pointed in the +z direction. Then, if you wanted to rotate the green pyramid in place relative to the green box, you'd do the following: move the box/pyramid system so the pyramid is centered on the z axis, then employ a rotation on just the pyramid, then displace the box/pyramid system back to where it was. I would think the result should be something like this:
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, 0.64).
But you have
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).
Why the -0.22 in the y rotation for the green pyramid in the starting position? I can't get my head around this one.
I have another question: Why can't you simply attach the antenna to the base in your model? Wouldn't that make this whole process easier?
The green box and pyramid were just a hypothetical example to explain the situation. The numbers I posted are from an actual setup. The green pyramid is the original location of the antenna, which happens to be rotated on the y and z axes. As I said earlier, I have a list of about 100 antennas, and some have rotations on all three axes. I can't attach the antenna to the base because it can't be done like that. I can't rotate a group of objects, I can only move and rotate one at a time.
What we are working on is an anti-cheat script. What we did is took several of the most popular bases, moved them to 0,0,0 and put the rotation to 0,0,0 while in the mission editor. Then, we put the antennas all over the bases, and recorded their positions and rotations. We have over 700 maps on the server, whenever a map is started that has one of the bases we have antennas set up for, it will spawn them all over the base with those positions and rotations. The problem is that those bases do not have the same positions and rotations. Some of the bases are rotated on all three axes, so we need some formulas that can figure out how to rotate and position the antennas correctly.
You know what? I didn't give you the correct link in post # 14. I just linked to the rotation matrix link on wiki. I think you're still wanting to employ the algorithm in post # 14. But here's the link that'll show you how to do the translations (and rotations) using 4 x 4 matrices. Take a good, long look at that link, and see if you don't come up with some ideas.