These forums are CLOSED. Please visit the new forums HERE
rotation script |
|
|
scubanutter Mills
Tanker, First Class
Join date: 16 Jul 2007
Posts: 18
|
07-18-2007 04:59
does anyone know of a script that allows an avatar to sit on or inside an object and then get controls to rotate it left, rgiht, up and down by either the arrows or the mouselook veiw ( not bothered which). thank you for anyone who can help me with my problem.
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
07-18-2007 10:31
See this script for the controls:
http://rpgstats.com/wiki/index.php?title=ExampleControls And then in the control() event, for each of the controsl you want add a line similar to the two that are already provided: if (pressed & CONTROL_LBUTTON) llOwnerSay("click" ;But instead of llOwnerSay, apply a rotation. Now the rotation requires the current rotation plus an adder (assuming you just want to rotate a given amount, rather than start it spinning), here's an example of spinning around the Z axis, I'll leave the other ones for you to experiment with: integer degree_increment=15; /* add 15 degrees to Z rotation, rotating counter-clockwise around the Z axis */ if (pressed & CONTROL_LEFT { /* llSetRot - set rotation*/ /* llGetRot - get current rotation */ /* llEuler2Rot - take in a vector of axis rotations, in degrees and make a 'rotation' */ /* note - to add a rotation to another, you actually multiply them */ llSetRot(llGetRot() * llEuler2Rot( < 0, 0, degree_increment * DEG_TO_RAD > )); } I'm not that good with rotations so god knows if I made a mistake there, but that should be the gist of it. |
|
scubanutter Mills
Tanker, First Class
Join date: 16 Jul 2007
Posts: 18
|
08-03-2007 02:22
sorry for my nooby question but which axis is the left right rot and which one is up down rot?
|
|
scubanutter Mills
Tanker, First Class
Join date: 16 Jul 2007
Posts: 18
|
08-03-2007 02:26
How do i adapt this script so instead of being used as an attachment it will activate when someone sits on the object that it is in?
default { attach(key who) { if (who == NULL_KEY) { // detached if (llGetPermissions() & PERMISSION_TAKE_CONTROLS) { llReleaseControls(); } } else { llRequestPermissions(who, PERMISSION_TAKE_CONTROLS); } } run_time_permissions(integer perms) { integer desired_controls = CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON ; if (perms & PERMISSION_TAKE_CONTROLS) { llTakeControls(desired_controls, TRUE, TRUE); } } control(key id, integer down, integer new) { integer pressed = down & new; integer held = down & ~new; integer released = ~down & new; if (pressed & CONTROL_LBUTTON) llOwnerSay("click" ;if (held & CONTROL_FWD) llOwnerSay("forward held" ;// etc. } } |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
08-03-2007 13:58
Take a look at the changed event, specifically the CHANGED_LINK flag is raised when you sit, or stand up.
_____________________
I'm back......
|
|
scubanutter Mills
Tanker, First Class
Join date: 16 Jul 2007
Posts: 18
|
08-09-2007 04:28
so just change attach to entry and use a seat script in the same prim would that work?
|