|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
04-06-2008 04:49
Right, yet again rotations have defeated me!
What I have are two, 2-dimensional points (x and y only, the z co-ordinate is irrelevant). What I want to do is have an object at point A rotated such that its z-axis is aimed at point B, while ensuring that the Y-axis remains pointing up (so the object stays flat).
Point B is actually calculated using a vector that indicates the direction from point A towards point B.
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
I only have a second...
04-06-2008 09:09
So this is a short answer.
I think you want to use llRot2Axes to get Fwd, Left, and Up. Change them, and use llAxes2Rot to make the new rotation.
lee
_____________________
So many monkeys, so little Shakespeare.
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
04-06-2008 09:19
Hmm, cheers for the suggestion, but I tried something along those lines earlier, it's the changing the axes part that I don't understand, and random trial and error hasn't worked thus far 
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
04-06-2008 09:46
vector fwd = llVecNorm(B - A); vector left = <0.0, 0.0, 1.0> % fwd; rotation new_rot = llEuler2Rot(<0.0, PI_BY_TWO, PI_BY_TWO>  ; new_rot = new_rot * llAxes2Rot(fwd, left, fwd % left); Oops, didn't realize that the Y-axis was meant to be up. This edit should work.
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
04-06-2008 13:43
Awesome, that works perfectly, cheers!
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|