|
Broccoli Curry
I am my alt's alt's alt.
Join date: 13 Jun 2006
Posts: 1,660
|
01-22-2008 05:42
I'm trying to create a drawbridge script. Basically, I want to, on clicking the sensor, raise the drawbridge about 80 degrees ... pause ... then lower back to flat. Usually for rotates, it's a permanent rotation so I use llTargetOmega which obviously isn't right for this. But I can't remember how to tell something to rotate from an absolute rotation, say x to x+80, especially over a duration. I thought there was a command to do that? Or am I just having a brain fart? I'm thinking something along the lines of Tower Bridge, just not so big or ornate 
_____________________
~ This space has been abandoned as I can no longer afford it.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
01-22-2008 06:30
You may be thinking of llSetRot(), but the "over a duration" thing sounds like llRotLookAt() (or possibly llLookAt(), but I'm guessing that would involve a little more math in this case).
_____________________
Archived for Your Protection
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
01-22-2008 07:10
llSetRot based on current rot plus a delta value, a counter variable and a timer.
|
|
Broccoli Curry
I am my alt's alt's alt.
Join date: 13 Jun 2006
Posts: 1,660
|
01-22-2008 11:22
Ok probably not the neatest solution but this at least works  rotation rot_xyzq; rotation rot_xyzq1; integer x; default { state_entry() { vector xyz_angles = <2,0,0>; // This is to define a 1 degee change vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation vector xyz_angles1 = <-2,0,0>; // This is to define a 1 degee change vector angles_in_radians1 = xyz_angles1*DEG_TO_RAD; // Change to Radians rot_xyzq1 = llEuler2Rot(angles_in_radians1); // Change to a Rotation } touch_start(integer s) { for (x = 1; x < 35; x++) { llSetRot(llGetRot()*rot_xyzq); //Do the Rotation... } for (x = 1; x < 35; x++) { llSetRot(llGetRot()*rot_xyzq1); //Do the Rotation... } } }
_____________________
~ This space has been abandoned as I can no longer afford it.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
01-22-2008 15:34
Void Singer just posted the world's simplest door script in the script library.
A drawbridge is just a door laying down.
_____________________
So many monkeys, so little Shakespeare.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-22-2008 17:07
the formula is localDegrees2Rot * currentRot requiring a cut root prim for something like ths. multiplying the .s component of the local portion by -1 will reverse the rotation.
rotation easyRot = llEuler2Rot( <how much you want to rot on which axis> * DEG_TO_RAD );
llSetRot( easyRot * llGetLocalRot() ); easyRot.s *= -1;
_____________________
| | . "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... | - 
|