Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I'm a rotation dunce! Simple quesiton

Jon Oddfellow
Registered User
Join date: 14 Sep 2005
Posts: 5
07-23-2006 13:58
I hvae a really simple question that's got me stumped. It would help if I were really a scripter, I'm sure.

I want to rotate a single object along a local axis (X, y, or z) so that when I postion it it will always rotate correctly. Could someone tell me/provide the simple code to do this? I have indeed searched these forums, as well as tried my hand at the wiki but I just can't seem to get any solution to work.

Jon
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
07-23-2006 14:00
From: Jon Oddfellow
when I postion it it will always rotate correctly.


Could you elaborate as to what you mean?
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jon Oddfellow
Registered User
Join date: 14 Sep 2005
Posts: 5
07-23-2006 14:05
ok, say I make a wheel and set it spinning correctly using the rotate script taht comes in the library. When I put the wheel in a different postion, it's rotating on the world axis and not it's own local axis. I need to to rotate on a local axis so that it's not world directional dependent.

make sense?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
07-23-2006 14:10
You will have to run a timer to do that.

CODE

vector axis = <0,0,1>;
float spinrate = 1;
float gain = 1;

float update = 5.0;
rotation previous = <0.0,0.0,0.0,0.0>;

default
{
state_entry()
{
llSetTimerEvent(update);
}
timer()
{
if((previous = llGetRot()) != previous)
llTargetOmega(axis * previous, spinrate, gain);
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jon Oddfellow
Registered User
Join date: 14 Sep 2005
Posts: 5
07-23-2006 14:18
thank you, thank yoiu, thank you!