Hmm. Question: do you just need to do this once, or are you going to have to do this repeatedly for slightly different translations, rotations, antenna orientations, etc.?

Printable View

- Jan 28th 2011, 07:31 AMAckbeet
Hmm. Question: do you just need to do this once, or are you going to have to do this repeatedly for slightly different translations, rotations, antenna orientations, etc.?

- Jan 28th 2011, 10:43 AMLiger
Repeatedly, for any angle of rotation and any position.

Thanks for your help so far. - Jan 28th 2011, 11:02 AMAckbeet
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.

- Jan 28th 2011, 11:12 AMLiger
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.

- Jan 31st 2011, 06:08 PMAckbeet
Haven't forgotten you. I'm wondering one thing: what determines how much "extra rotation" you want to give the antenna (that is, what determines the new direction of the green light)?

- Feb 1st 2011, 08:40 AMLiger
That must be computed. The only values known are the original position/rotatation and the position/rotation of the new base. Nothing about the new position/rotation of the antenna is known.

- Feb 2nd 2011, 05:57 AMAckbeet
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? - Feb 5th 2011, 12:10 PMLiger
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. - Feb 24th 2011, 06:34 PMLiger
Any thoughts on this? I know this is a difficult problem, and I'm not in a rush. I've tried asking for help on other forums, and I either don't get a reply, or they say to look into Quaternions, which I don't know how to use.

- Feb 25th 2011, 03:33 AMAckbeet
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.