Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotate 45 degrees

Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
05-27-2007 09:45
Hi,

I wonder how to script a object/prim that will rotate 45 degrees and back.

Could some 1 help me with this...
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
05-27-2007 13:38
What have you tried so far?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-27-2007 14:12
Take a look at this thread
_____________________
I'm back......
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
05-28-2007 02:53
default
{
state_entry()
{
vector eul = <0, 0, 45>; //45 degrees around the z-axis
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot( eul );
llSetRot( quat );
}
}

no it should turn back 45 degrees after xx seconds.

I wana make it chat command...that's easy...but on stop I like to stop it into default position.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-28-2007 03:28
From: Milcoi Delcon
default
{
state_entry()
{
vector eul = <0, 0, 45>; //45 degrees around the z-axis
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot( eul );
llSetRot( quat );
}
}

no it should turn back 45 degrees after xx seconds.

I wana make it chat command...that's easy...but on stop I like to stop it into default position.


What you have posted will just make it position itself at a 45 degree angle it wont rotate at all. Look at the thread I gave you for an example of making stuff rotate between two angles. Adding a listen is straightforward as would be stopping it back at the starting point.
_____________________
I'm back......
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
05-28-2007 12:24
also, it looks to me like <0,0,45> will be in world coordinates, not local ones. That is, you are always going to face NE.
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
05-28-2007 22:19
ok thanks!! but how are you guy's solve this..?
Dnel DaSilva
Master Xessorizer
Join date: 22 May 2005
Posts: 781
05-29-2007 01:35
From: Milcoi Delcon
ok thanks!! but how are you guy's solve this..?


Use a timer or llSleep()

Turn
wait
turn back
_____________________
Xessories in Urbane, home of high quality jewelry and accessories.

Coming soon to www.xessories.net

Why accessorize when you can Xessorize?
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
05-29-2007 02:37
Like this....?

default
{
state_entry()
{
vector forward = <0, 0, 45>; //45 degrees around the z-axis
forward *= DEG_TO_RAD;
rotation quatforward = llEuler2Rot( forward );
llSetRot( quatforward );
}
{
llSleep(1);
vector backward = <0, 0, -45>; //-45 degrees around the z-axis
backward *= DEG_TO_RAD;
rotation quatbackward = llEuler2Rot( backward );
llSetRot( quatbackward );
}
}
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
05-29-2007 11:48
Milcoi, there is an unwritten rule in this forum that you don't just write scrips for people. If you want to hire a scripter, you can do that.

I suggest you search through the Script Library and search the Wiki (the the SL wiki, the good ones...) and read some scripts. You will learn a lot.

Still, here is a rough outline of what you want.


CODE

integer rotated = FALSE;
default {

state_entry()
{
...stuff here...
llSetTimerEvent(1);
rotate your object.
rotated = TRUE;
}

timer()
{
if( rotated )
rotate back
rotated=FALSE;
else
rotate
rotated=TRUE
}
}