Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rotate a linked prim

Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
08-30-2005 15:34
Hello, I'm not a scripter and this is causing me a headache. I have an object that has rings rotating around it. If somebody comes by and clicks on it to see whats inside the rings stop moving. I then have to go back in and re-save the script to get them to rotate again.
My question is this, is there a way to get them to start moving again without having to re-save the script?
Here's the script that I'm using. Thanks for any help that you can give me.

From: someone
//rotate linked prim
default
{
state_entry()
{
//multiply desired rotation (<x,y,z>;) with local rotation of parent, rate is PI, gain is 1.
llTargetOmega(<2,0,0> * llGetLocalRot(),PI,1.0);
}

}
a lost user
Join date: ?
Posts: ?
Add touch_start state
08-30-2005 17:11
Robin - I'm not sure why your rotation is stopping when someone touches it. However, I think if you add a touch_start state section to your script, with the same code as in state_entry, it may fix your problem.

Like this:

//rotate linked prim
default
{
state_entry()
{
// multiply desired rotation (<x,y,z>;) with local rotation of parent,
// rate is PI, gain is 1.
llTargetOmega(<2,0,0> * llGetLocalRot(),PI,1.0);
}

touch_start (integer param)
{
llTargetOmega(<2,0,0> * llGetLocalRot(),PI,1.0);
}
}
Angus Kuhr
Dwarf with a Hammer
Join date: 17 Jul 2005
Posts: 43
08-30-2005 17:50
I'm assuming that it will stop rotating things whenever something changes.

The best thing to do, I think, would be to play with states. If you do that, you won't need to restart the script every time. Generally, I only use the default state for initialization things.

example:

default

{

state_entry

{ (start rotating, initialization)

state rotating;

}

}

state rotating

{

state_entry

{ (rotationstuff)

}

touch_start

{

state reset;

}

}

state reset

{

state_entry

{

state rotating;

}

}


What that will do is get around the problem of stopping when touched, as it will to back to rotating again. One thing about this is, you CANNOT have a state call itself. You have to have a "reset" state to do that.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-30-2005 19:20
llTargetOmega is a client-side rotation, which means the object doesn't really rotate, it just tells the client to make it look like it rotates. That function is known for sometimes not updating the client, which would make it appear to stop rotating. Not sure if that's what you're experiencing, but it's a possibility. Search for llTargetOmega in this forum, it's been discussed in the past, including workarounds for the behavior. You need to force an update to the client. An easy way that sometimes/usually works is to add llSetAlpha(llGetAlpha(0), 0) after the llTargetOmega call.