[sldev] Rotation
Matthew Underwood
sakkaku at gmail.com
Wed May 7 18:31:26 PDT 2008
On Wed, May 7, 2008 at 8:52 PM, Ratnadeep Paul <paulratnadeep at yahoo.com> wrote:
> Hi All
>
> I am a pretty new user to Linden Scripting. I have a specific problem. I
> need to rotate an object using scripts. My task is to rotate the prim about
> Y-axis, X-axis and Z-axis in that order plus I would like to rotate each
> time about the global axes and not the local axes.
> Can somebody help me? I know it must be very simple but I would like some
> push or hint in a general direction.
> Any help is welcome.
>
> Regards
> Paul
I am going to assume this is an attachment? To rotate around in a
circle I wrote up this function awhile back:
list GenerateRotationList(integer num)
{
list RotationList = [];
float increment = 360 / (float) num;
vector Rot = <0,0,0>;
while(num--)
RotationList += llEuler2Rot( (Rot += <0,0,increment>) * DEG_TO_RAD );
return RotationList;
}
Where num is the "points" around the axis that you would like with the
last one being on ZERO_ROTATION. If you don't actually need that
precision (and just want to rotate constantly) you can use
llTargetOmega and it will rotate constantly (without making the sim
have to be tortured by a timer). I think you get get the region (not
local) rotation by multiplying the rotation by the avatars global
rotation but I haven't tested this though.
More information about the SLDev
mailing list