Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotation Question

Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-07-2007 00:18
I'm attempting to rotate a child prim about the center of the root prim without rotating the root. How is this done? (without introducing a 3rd prim to use as a rotator prim).
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-07-2007 01:00
Unless you've already been there, perhaps can help:
From: someone
Note: An object can be rotated around an arbitrary point by multiplying a vector by a rotation in the manner described above. The vector should be the difference between the object's current position and the desired "center-point" of rotation. Take the result of the multiplication and add it to the point of rotation. This vector will be the "new location" the object should be moved to.

vector currentPos = llGetPos();
vector rotPoint = llGetPos() + <1, 1, 1>; // in global coordinates
vector newPos = rotPoint + ((currentPos - rotPoint) * x_45);
llSetPos(newPos);

Bear in mind that any translation (position) operation can result in a vector that would put the object outside of the world, or require a move further than 10 meters--so plan for these possibilities.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-07-2007 02:36
Qie, thank you, exactly what I needed :)