rotation script goes wacky when turned
|
|
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
|
01-21-2008 18:48
I've looked all through the forums but can't find help on fixing this script to work after it is rotated at an angle:
default { state_entry() { llTargetOmega(<1,0,0>,1,1); }
}
Just want it to not go bonkers when the gear its in is turned at an angle when being positioned. I'm pretty much a scripting dummie. any help would be appreciated. thanks.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-21-2008 19:48
If you want it to rotate about its local x-axis, which seems likely, try:
llTargetOmega(llRot2Fwd(llGetRot()), ...);
The llRot2Fwd(), llRot2Left() and llRot2Up() functions retrieve the local x-, y-, and z-axes respectively, given the prim's rotation.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-22-2008 03:52
<1,0,0> * llGetRot() should work also
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
01-22-2008 15:43
You might need to to reset the script after you rotate it.
_____________________
So many monkeys, so little Shakespeare.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-22-2008 16:06
True. Not reset specifically, but re-execute an appropriate llTargetOmega(). Resetting would be one way to do that. Might well be necessary.
|
|
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
|
01-22-2008 17:51
heyas;
i always thought target omega went on the object (or the root object) local axes. yet im finding i have to change it when i change something from an east-west orientation to a north-south? what's up with that? :/
_____________________
Why Johnny Can't Rotate: http://forums.secondlife.com/showthread.php?t=94705
|
|
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
|
Still being wacky rotation
01-22-2008 18:42
Still haven't found a way to turn my rotating gear at an angle and have it rotate properly (without resetting the scrilpt). Would rather not have to reset a script when it gets rezzed each time from a rez-faux type rezzer.
this version worked fine for putting the gear at an angle, but still requires a script reset when the gear is moved. any way to avoid doing a reset?
default { state_entry() { llTargetOmega(<0, 0, 1> * llGetRot(), 2, 2); }
}
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-22-2008 20:03
Try something like this: float TIMER_PERIOD = 3.0; rotation oldRot;
renewRotation() { oldRot = llGetRot(); llTargetOmega(<0, 0, 1> * oldRot, 2, 2); }
default { state_entry() { renewRotation(); llSetTimerEvent(TIMER_PERIOD); }
on_rez(integer startParam) { renewRotation(); }
timer() { if (llGetRot() != oldRot) { renewRotation(); } } }
|
|
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
|
works like a dream Hewee
01-22-2008 20:39
ok this is really nice. works perfectly, goes in rezzer comes out turn gears in any direction and they automatically snap into proper rotation. thanks so much
|