Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple question about rotation

Mickey James
Registered User
Join date: 4 Nov 2006
Posts: 334
07-06-2007 13:31
... as if there are ever any simple questions about rotation ...

What I'm trying to do is have an object take movement controls when sat on and then respond to the movement inputs pretty much as the avatar would. The script I've written works fine for moving forward, backward, up and down, but I'm having trouble getting it to turn.

The code I'm using is:

if (held & CONTROL_ROT_LEFT)
{
vector eul = <0,0,10>;
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot(eul);
llSetRot(quat);
}

That will turn it the 10 degrees around the Z axis specified, but then it stops and even re-pressing the arrow key will not start it again.

I want it to turn continuously until the user releases the key, but obviously llSetRot does not work the same as llSetPos in this regard.

What am I doing wrong?
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
07-06-2007 13:37
You are setting an absolute rotation, I think. Do you use this exact code for the other rotations?

Try this line instead of the existing llSetRot() call:
CODE

llSetRot( llGetRot() * quat );
_____________________