Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Math/Geometry Help Again

Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
10-30-2007 13:58
OK, I think this is a pretty straightforward problem, I just don't know the math for it. If two or more prims are linked, changing the position or rotation of one naturally changes them all. What I want to do is imitate this behavior with un-linked objects. I want objects A and B to be able to move independently of C, but able to reset to defined positions relative to C when desired, regardless of C's position or rotation. To illustrate:



The boxes are linked, with B as the root. If I rotate it:



A and C not only match the rotation, but change X and Y as well. The rotation part is easy, of course, it's the X and Y I can't get. I've been experimenting, linking boxes, rotating them, then unlinking and checking the difference in the coordinates of the "child" prims, and I understand it's a function of distance and rotation, but I just can't see the relationship between the numbers clearly enough to develop a formula.
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
10-30-2007 14:03
From: Siann Beck
OK, I think this is a pretty straightforward problem, I just don't know the math for it. If two or more prims are linked, changing the position or rotation of one naturally changes them all. What I want to do is imitate this behavior with un-linked objects. I want objects A and B to be able to move independently of C, but able to reset to defined positions relative to C when desired, regardless of C's position or rotation. To illustrate:



The boxes are linked, with B as the root. If I rotate it:



A and C not only match the rotation, but change X and Y as well. The rotation part is easy, of course, it's the X and Y I can't get. I've been experimenting, linking boxes, rotating them, then unlinking and checking the difference in the coordinates of the "child" prims, and I understand it's a function of distance and rotation, but I just can't see the relationship between the numbers clearly enough to develop a formula.

Originally, you know the position of A relative to B, which is (position of a - position of b). All you do is take this offset, rotate it by B's rotation, and add it to B's position.
_____________________
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
10-30-2007 16:54
Works perfectly! Thank you!