10-09-2005 14:09
I've managed to make a prim pivot around its end point, but it only works when the prim is aligned on global axes. In this example, I'm pivoting around the 'bottom' of the prim's x axis, rotating around the y axis.
If the prim's starting rotation is <0, anything, 0> it works, but that's the only case.
CODE
   
...
rotation yRot = llEuler2Rot( <0, 15 * DEG_TO_RAD, 0> );

vector pivotPoint = xStartPoint(currentPos, currentRot, size.x);
rotation newRot = yRot * currentRot; // compute local rotation

vector newPos = pivotPoint + ((currentPos - pivotPoint) * yRot);

llSetPrimitiveParams([PRIM_POSITION, newPos, PRIM_ROTATION, newRot]);


The pivot point is definitely correct. I'm sure the problem is this line...
CODE

vector newPos = pivotPoint + ((currentPos - pivotPoint) * yRot);

I'm guessing that yRot should be changed to account for the prim's rotation. But since I really don't understand the math, I haven't figured out how to solve my problem. I've tried a couple things that were just wrong. Or my guess could just be way off base.

Can someone help? Also, can someone explain what it means to multiply a vector by a rotation ?

Thanks!
_____________________
Shiny Things accessories
Shiny Falls(170,180)

Fallingwater Flowers
Shiny Falls(83,187)