Jump to content

Search the Community

Showing results for tags 'rotation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Important News
    • Announcements
  • People Forum
    • Your Avatar
    • Make Friends
    • Lifestyles and Relationships
    • Role Play
    • General Discussion Forum
    • Forums Feedback
    • Second Life Education and Nonprofits
  • Places and Events Forum
    • Favorite Destinations
    • Upcoming Events and Activities
    • Games in Second Life
  • Official Contests, Events & Challenges
    • Challenges
    • Contests
  • Creation Forum
    • Fashion
    • Art, Music and Photography
    • Animation Forum
    • Bakes on Mesh
    • Environmental Enhancement Project
    • Machinima Forum
    • Building and Texturing Forum
    • Mesh
    • LSL Scripting
    • Experience Tools Forum
  • Technology Forum
    • Second Life Server
    • Second Life Viewer
    • Second Life Web
    • General Second Life Tech Discussion
    • Mobile
  • Commerce Forum
    • Merchants
    • Inworld Employment
    • Wanted
  • Land Forum
    • General Discussion
    • Mainland
    • Linden Homes
    • Wanted
    • Regions for Sale
    • Regions for Rent
  • International Forum
    • Deutsches Forum
    • Foro en español
    • Forum in italiano
    • Forum français
    • 日本語フォーラム
    • 한국어 포럼
    • Fórum em português
    • Forum polskie
    • المنتدى العربي
    • Türkçe Forum
    • Форум по-русски
  • Answers
    • Abuse and Griefing
    • Account
    • Avatar
    • Creation
    • Inventory
    • Getting Started
    • Controls
    • Land
    • Linden Dollars (L$)
    • Shopping
    • Technical
    • Viewers
    • Everything Else
    • International Answers


  • Commerce
  • Featured News
  • Inworld
  • Tools and Technology
  • Tips and Tricks
  • Land
  • Community News


  • English
  • Deutsch
  • Français
  • Español
  • Português
  • 日本語
  • Italiano
  • Pусский
  • Türkçe

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me

Member Title

  1. so i want to do a spinning chain and i got rotation script and it works perfect as its rotate on its Y, but the problem start when i attach the clasp ( the chain holder ) to the pendant casuing it to rotate too since every rotation script i ever bought ( i bought many ) always takes control on everything that attached to the mesh. and i dont want the clasp to spin i want it to stay in its place as the rest spinning, i did try putting the script inside every link set like link 1 link 2 they called the childs i believe, seperatly so everything will have the script and not the parent link but it doesnt work well it makes it rotate on its own and not together like i want. my question is can u do the whole thing to rotate but not the chain holder ? or is there a block script that can stop it from recieving the rotate script.. i have like 10 materials in the mesh if its matter since i noticed every material has its own link number, thank u for ur time to read and if u can help !
  2. Hi I am trying to send a physical object from A to B in a horizontal straight line, which is easy enough and I have that part working. However, I also want to be able to fully control it's rotation during movement. By 'fully' that means I may want a single 'barrel roll' during movement, or I may want it to rotate several times - independent control of all axis, so if wanted I can create a one or more axis 'tumbling' rotation during movement, too. Here's what I have so far: default { state_entry() { vector pos = llGetPos(); vector offset = <5, 0, 0>; // Move 5m 'east'. pos+=offset; llSetStatus(STATUS_PHYSICS, TRUE); llLookAt(llGetPos()+<0.0, 0.0, 1.0>, 1.0, 0.1); // Ignore - an experiment to prove to myself that I can force a rotation during movement. llSleep(3.0); // Not sure why a Sleep is needed but wont work without it. llMoveToTarget(pos, 1.0); llSetStatus(STATUS_PHYSICS, 0); } } Your thoughts are very welcome! Thank you.
  3. Hello! I'm fairly new to scripting in SL and am currently working on a flying airship-type vehicle using modifiable pre-existing scripts. Part of the plan was to have turrets that are rooted to the ship itself that move with the camera movement of a user, not necessarily the driver. The issue I am having is this: The turret script works properly to rotate the child (which houses the script) when linked with the root, as long as it is not physical. If the object becomes physical, as is the case with the airship when it is flying, the turret script then rotates the whole object (both root and children). I would only like the child object to rotate based on camera movement, even if the entire object is physical. The turret script allows an object to be rotated through the same rotation as the person who clicked the object's camera. The airship's script turns the airship physical during flight Turret Script: key toucher; string toucherS; float SPEED = 40.0; integer LIFETIME = 7; float DELAY = 0.2; vector vel; vector pos; rotation rot; integer in_use; integer have_permissions = FALSE; integer armed = TRUE; fire() { rot = llGetRot(); vel = llRot2Fwd(rot); pos = llGetPos(); pos = pos + vel; pos.z += 0.0; vel = vel * SPEED; llTriggerSound("shoot", 1.0); llRezObject("bullet", pos, vel, rot, 1); } default { state_entry() { in_use = FALSE; } touch_start(integer total_number) { if(in_use == FALSE) { toucher = llDetectedKey(0); llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION); llSetText("Requesting Permissions", <1,1,1>, 1); } if(in_use == TRUE) { if(llDetectedKey(0) == toucher) { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("", <1,1,1>, 1); in_use = FALSE; } } } sensor(integer sense) { rotation k = llDetectedRot(0); llRotLookAt(k, .1, .1); } no_sensor() { llReleaseControls(); llSensorRemove(); llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); llSetText("", <1,1,1>, 1); in_use = FALSE; } run_time_permissions(integer perm) { if(perm) { llSetText("", <1,1,1>, 1); llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1); llSetText("Current User: "+llKey2Name(toucher), <1,1,1>, 1); in_use = TRUE; } else { in_use = FALSE; llSetText("", <1,3,1>, 1); } } control(key name, integer levels, integer edges) { if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) { fire(); } } } // END // Airship Script: // SoloFlight // by Solo Mornington // This script is based on the HC-1 flight script by illume Skallagrimson // but VERY HEAVILY MODIFIED. :-) // we only have a position for the sit target, no rotation. it is assumed that // this script is in the root prim of a zero-rotation object. vector gSitTarget = <2.01, 0.002, 9.005>; string gSitText = "Fly away"; // Text to show in the pie menu for sitting string gAnimationName; // this will be the first animation in inventory string gLoopSound = "tugboat"; // the sound to loop during flying. key gPilot = NULL_KEY; // who's flying? (distinct from passengers) // these are values for the vehicle motors // they'd more properly be state-scope variable for state flying. // https://jira.secondlife.com/browse/SVC-3297 vector linear; vector angular; float water_offset = 1.6; // Defining the Parameters of the normal driving camera. // This will let us follow behind with a loose camera. list gDriveCam =[ CAMERA_ACTIVE, TRUE, CAMERA_BEHINDNESS_ANGLE, 0.0, CAMERA_BEHINDNESS_LAG, 0.5, CAMERA_DISTANCE, 2.0, CAMERA_PITCH, 05.0, CAMERA_FOCUS_LAG, 0.05, CAMERA_FOCUS_LOCKED, FALSE, CAMERA_FOCUS_THRESHOLD, 0.0, CAMERA_POSITION_LAG, 0.5, CAMERA_POSITION_LOCKED, FALSE, CAMERA_POSITION_THRESHOLD, 0.0, CAMERA_FOCUS_OFFSET, <0,0,0>]; // lists of which prims are legs and wings, so we can do special effects list gWingPrims; list gLegPrims; setVehicle() { llCollisionSound("", 0.0); llSetVehicleType(VEHICLE_TYPE_AIRPLANE); // linear friction llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <100.0, 100.0, 100.0>); // uniform angular friction llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, 1.0); // linear motor llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0.0, 0.0, 0.0>); llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, .5); llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 1.0); // angular motor llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0.0, 0.0, 0.0>); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, .4); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 2.0); // hover llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, 0.0); llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.0); llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 350.0); llSetVehicleFloatParam(VEHICLE_BUOYANCY, 1.0); // linear deflection llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5); llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1.0); // angular deflection llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.25); llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 100.0); // vertical attractor llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.75); llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1.0); // banking llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 0.0); llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 1.0); llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 360.0); // default rotation of local frame llSetVehicleRotationParam(VEHICLE_REFERENCE_FRAME, <0.0, 0.0, 0.0, 1.0>); // removed vehicle flags llRemoveVehicleFlags(VEHICLE_FLAG_NO_DEFLECTION_UP | VEHICLE_FLAG_HOVER_WATER_ONLY | VEHICLE_FLAG_HOVER_TERRAIN_ONLY | VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_LIMIT_MOTOR_UP | VEHICLE_FLAG_LIMIT_ROLL_ONLY); // set vehicle flags llSetVehicleFlags(VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT); } loadLegAndWingPrims() { gWingPrims = []; gLegPrims = []; integer i; list params; // use llGetObjectPrimCount() so we don't include seated avatars. integer count = llGetObjectPrimCount(llGetKey()); for (i=1; i<=count; ++i) { params = llGetLinkPrimitiveParams(i, [PRIM_DESC]); string desc = llList2String(params, 0); if (desc == "leg") gLegPrims += [i]; if (desc == "wing") gWingPrims += [i]; } } newAnimationCheck() { // we might have a new animation in inventory // and if we do, stop the old one and play the new one. if (gPilot != NULL_KEY) { llStopAnimation(gAnimationName); gAnimationName = llGetInventoryName(INVENTORY_ANIMATION, 0); llStartAnimation(gAnimationName); return; } gAnimationName = llGetInventoryName(INVENTORY_ANIMATION, 0); } primAlpha(list prims, float alpha) { // set prims to be transparent integer i; integer count = llGetListLength(prims); for (i=0; i<count; ++i) { llSetLinkAlpha(llList2Integer(prims, i), alpha, ALL_SIDES); } } wingFlapAlpha() { integer i; integer count = llGetListLength(gWingPrims); for (i=0; i<count; ++i) { if (llFrand(1.0) > 0.5) llSetLinkAlpha(llList2Integer(gWingPrims, i), 0.7, ALL_SIDES); else llSetLinkAlpha(llList2Integer(gWingPrims, i), 0.3, ALL_SIDES); } } default { state_entry() { // load up the exception prims loadLegAndWingPrims(); // some basic initializations gPilot = NULL_KEY; newAnimationCheck(); llSitTarget(gSitTarget, ZERO_ROTATION); llSetSitText(gSitText); state atRest; } } state atRest { // state atRest is the state we should be in when the vehicle is at rest // just sitting there, as in we just rezzed it, or the avatar stood up from it. // mainly this state is responsible for starting the flying sequence when // the owner sits on the vehicle. state_entry() { // nobody flying the thing... gPilot = NULL_KEY; // hide the wings and show the legs primAlpha(gWingPrims, 0.0); primAlpha(gLegPrims, 1.0); // turn off vehicle stuff. llSetStatus(STATUS_PHYSICS, FALSE); // TODO: make the vehicle right itself. // let the whole object know we're at rest. } changed(integer what) { // Whenever an av sits on or stands up from an object, it is treated as if it // were being linked or unlinked. // Unfortunately, there are a whole bunch of other things that cause CHANGED_LINK // as well, so we have to allow for them. // Things that can cause CHANGED_LINK: 1) linking in new prims, 2) unlinking prims // 3) avatars sitting, 4) avatars unsitting if (what & CHANGED_LINK) { // are there *any* seated avatars? if (llGetNumberOfPrims() != llGetObjectPrimCount(llGetKey())) { // we have seated avs, so let's find the sit target one key agent = llAvatarOnSitTarget(); if(llSameGroup(agent)) { gPilot = agent; // ask politely for permission do to stuff. // These will be automatically granted. llRequestPermissions(agent,PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS | PERMISSION_TRACK_CAMERA | PERMISSION_CONTROL_CAMERA); } if(llSameGroup(agent) != TRUE) // sit target agent is not the owner { llUnSit(agent); llWhisper(0,"Only the Kumiho Family can drive this vehicle."); } } else // there are no seated avatars... { if (gPilot != NULL_KEY) { // since there are no seated avs, but we still know about // the pilot, they must have just stood up. // we need to release controls and do other cleanup llSetTimerEvent(0); llReleaseControls(); llClearCameraParams(); llStopLookAt(); llStopAnimation(gAnimationName); gPilot = NULL_KEY; llMessageLinked(LINK_ALL_OTHERS, 0, "stop", NULL_KEY); } } } if (what & CHANGED_INVENTORY) { // someone might have dropped in a new animation newAnimationCheck(); } } run_time_permissions(integer perm) { // to be correct, we really should check the perms and make sure we // got the ones we need. but this will usually work: if (perm) state flying; } on_rez(integer foo) { state default; } } state flying { // state flying assumes we have permission to take controls, run animations, // and control the camera. state_entry() { // hide the legs, show the wings... primAlpha(gLegPrims, 0.0); wingFlapAlpha(); // play the flying sound llLoopSound(gLoopSound, 1.0); llSetTimerEvent(0.05); llTakeControls( CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON, TRUE, FALSE); setVehicle(); llSetCameraParams(gDriveCam); llStartAnimation(gAnimationName); vector current_pos = llGetPos(); llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, current_pos.z); llSetStatus(STATUS_PHYSICS, TRUE); // let the rest of the object know we're flying llMessageLinked(LINK_ALL_OTHERS, 0, "flying", NULL_KEY); } changed(integer what) { // Whenever an av sits on or stands up from an object, it is treated as if it // were being linked or unlinked. // Unfortunately, there are a whole bunch of other things that cause CHANGED_LINK // as well, so we have to allow for them. // Things that can cause CHANGED_LINK: 1) linking in new prims, 2) unlinking prims // 3) avatars sitting, 4) avatars unsitting if (what & CHANGED_LINK) { // are there *any* seated avatars? if (llGetNumberOfPrims() == llGetObjectPrimCount(llGetKey())) { // there are no seated avatars... if (gPilot != NULL_KEY) { // since there are no seated avs, but we still know about // the pilot, they must have just stood up, so let's rest. state atRest; } } } if (what & CHANGED_INVENTORY) { newAnimationCheck(); } } // The control event is what we get when the user mashed down the keys // we asked about in llTakeControls(). control(key id, integer levels, integer edges) { if(llGetStatus(STATUS_PHYSICS)!=TRUE) llSetStatus(STATUS_PHYSICS, TRUE); if ((edges & levels & CONTROL_UP)) { linear.z += 12.0; } else if ((edges & ~levels & CONTROL_UP)) { linear.z -= 12.0;} if ((edges & levels & CONTROL_DOWN)) { linear.z -= 12.0; } else if ((edges & ~levels & CONTROL_DOWN)) { linear.z += 12.0;} if ((edges & levels & CONTROL_FWD)) { linear.x += 14.0; } else if ((edges & ~levels & CONTROL_FWD)) { linear.x -= 14.0;} if ((edges & levels & CONTROL_BACK)) { linear.x -= 14.0; } else if ((edges & ~levels & CONTROL_BACK)) { linear.x += 14.0;} if ((edges & levels & CONTROL_LEFT)) { linear.y += 8.0; } else if ((edges & ~levels & CONTROL_LEFT)) { linear.y -= 8.0;} if ((edges & levels & CONTROL_RIGHT)) { linear.y -= 8.0; } else if ((edges & ~levels & CONTROL_RIGHT)) { linear.y += 8.0;} if ((edges & levels & CONTROL_ROT_LEFT)) { angular.z += (PI / 180) * 55.0; angular.x -= PI * 4; } else if ((edges & ~levels & CONTROL_ROT_LEFT)) { angular.z -= (PI / 180) * 55.0; angular.x += PI * 4;} if ((edges & levels & CONTROL_ROT_RIGHT)) { angular.z -= (PI / 180) * 55.0; angular.x += PI * 4; } else if ((edges & ~levels & CONTROL_ROT_RIGHT)) { angular.z += (PI / 180) * 55.0; angular.x -= PI * 4; } if ((edges & levels & CONTROL_ML_LBUTTON)) { llMessageLinked(LINK_ALL_OTHERS, 0, "fire", NULL_KEY); } } timer() { wingFlapAlpha(); if (llGetAgentInfo(gPilot) & AGENT_MOUSELOOK) { vector rot = llRot2Euler(llGetCameraRot()); llRotLookAt(llEuler2Rot(<0,0,rot.z>),0.1,1); } else { llStopLookAt(); } vector vel = llGetVel(); float water = llWater(vel * 0.05); float ground = llGround(vel * 0.05); if (water > ground) { // above water vector MahPos = llGetPos(); if (MahPos.z < water+water_offset){ llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.5); llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 0.1); llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, water + water_offset); } else { llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.0); llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 350.0); } } else { // above ground llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.0); llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 350.0); } llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, linear); llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular); } state_exit() { // we need to release controls and do other cleanup llStopSound(); llSetTimerEvent(0); llStopLookAt(); llReleaseControls(); llClearCameraParams(); llStopAnimation(gAnimationName); llMessageLinked(LINK_ALL_OTHERS, 0, "stop", NULL_KEY); } on_rez(integer foo) { state default; } } //END//
  4. Hi! I've been working on a script somone put into the public domain, trying to adapt it to my purpose, which is to rez an NPC when it receives a message via a Dataserver call. Broadly, it works fine, but upon rezing, I want the NPC to adaopt the included (static) animation and to face a particular direction. It's this last part that won't work. No matter what value I put in for the Z rotation, the NPC will behave as follows: 1) It tends not to change direction at all for small (Less than about 7 or 8 degrees) increments/decrements of Z 2) Then it will suddenly change direction by an estimated 20 or so degrees. 3) it cannot be made to face any direction in between it's two jumps 4) For some values, it jumps into a wildly different direction. 5) Overall, it seems to be a toss up between only about 4 or 5 directions it will face, and none other, no matter which of the 360 degrees I try. Here's the relevant piece of code I believe. Where you see "185" in this example; that's the value I'm changing, but the results don't change as expected/intended. Clearly I'm doing something wrong here, but can anyone tell me what? if(npc_on == FALSE) { npc = osNpcCreate("", "", npcPos, npc); npc_on = TRUE; llSensor("", "", AGENT | NPC, 96.0, PI); vector xyz_angles = <1.0, 1.0, 185.0>; vector angles_in_radians = xyz_angles * DEG_TO_RAD; // Change to Radians rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation osNpcSetRot(npc, rot_xyzq); osNpcPlayAnimation(npc, "My animation"); } Thank you in advance for your thoughts!
  5. i have a prim with sensor which can follow me when i call it ,it uses RotLookAt to look in the same rotaion of my AVI but it comes with its back if i look at it , so i used a rotation offset in z by 180 degree to make it comes to me but if i call it while my back to this prim ,it comes with back cant solve this anyone can help i appreciate this example will be used for pet cat this is script in object : //// rotation rot_xyzq; oppisiteRot() { rotation rot = llDetectedRot(0); vector xyz_angles = <0,0,180>; // This is to define a 1 degree change vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians rot_xyzq = llEuler2Rot(angles_in_radians); llRotLookAt(rot*rot_xyzq, .1 , 1); } default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); } touch_start(integer num_detected) { vector pos = llGetPos(); // Look for owner within 20 meters in 360 degree arc every 1 seconds. llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0); } sensor(integer total_number) { oppisiteRot(); vector pos = llDetectedPos(0); // Offset back one meter in X and up one meter in Z based on world coordinates. vector offset =<-1,0,1>; // offset = offset*llDetectedRot(0); //Adding this line will orient the follower relative to the owner's position. pos+=offset; llMoveToTarget(pos,0.4); } }
  6. Hi! I am decent at scripting, but have a blind spot the size of Jupiter when it comes to rotations. I have a scenario where I have a flat prim on the ground (basically an invisible doormat), where a collision triggers a bit of chat to the agent. No biggie. However, I need it to respond differently depending on whether an avatar is moving in line with or contrary to the prim's local "forward" axis (x-axis in my test prim). After some testing, I figured I could theoretically do this with the rotation difference between the prim and the avatar. Depending on the global quadrant the prim is facing (and the direction the avatar is facing when walking), this is (in vectors) either <0.0, 0.0, 0.0> or <180, 0, 0>. This would basically cover scenarios 1 and 2 below where you move forward with W, with the camera position behind you. Trick is that it's also possible to move "backwards", by which I mean pressing the S, to that your avatar is facing the camera. (I'm leaving aside, for the moment, that an avatar can cross left-to-right or right-to-left as well) I also get the feeling that my lack of trigonometry skill is causing me to over-complicate things. Can someone point me in the right direction (pun totally intended) on how I can get this to work robustly? I attached an image detailing my four scenarios.
  7. First of all I apologize if I have posted this in the wrong spot. I am trying to use a poseball and everytime I sit on it I end up sideways or upside down. I'm sure there is a way to rotate I just can't figure it out. Thank you!
  8. Hi everyone I have been posting in LSL scripting groups hopeful for a solution and am starting to believe we are loosing a generation of scripters that i am supposed to fill their shoes one-day. My problem is with a rotation I am using the following script from an brilliant person on LSL who has moved onto other ventures. This was her creation . a friend Zambe made this gif for me showing what i require it to do: https://gyazo.com/055061a745dd16534dad968c9a6943f9 The problem is that upon asking several key scripters they all returned what i already had , which sequentially reads the position of an object and adds a rotation to it. This is unhelpful as one cal loose track of rotation easily and the only answer was to capture the previous rotation angle and move forward with next angle by deleting the previous . This would work but is no rotation solution I feel you should be able to set a llRotUp() option on the pink axis and then move from this ZERO_ROTATION to a new absolute angle now this problem is compounded by two boxes which have to stay synced to each other and both need adjustment as below: float rotClickAngle = 5; do_rotate(){ list L = llGetLinkPrimitiveParams(link_axis,[PRIM_ROT_LOCAL, PRIM_POS_LOCAL]); rotation rotRoot2Axis = llList2Rot(L,0); vector posRoot2Axis = llList2Vector(L,1); vector axisAxis=<0,0,1>*rotRoot2Axis; rotation rotClick_inRootFrame = llAxisAngle2Rot(axisAxis, rotClickAngle *DEG_TO_RAD); // for body. L = llGetLinkPrimitiveParams(link_box1,[PRIM_ROT_LOCAL, PRIM_POS_LOCAL]); rotation rotRoot2Body = llList2Rot(L,0); vector posRoot2Body = llList2Vector(L,1); rotation newrotRoot2Body = rotRoot2Body * rotClick_inRootFrame; vector offsetBody_inRootFrame = posRoot2Body - posRoot2Axis; vector newoffsetBody_inRootFrame = offsetBody_inRootFrame* rotClick_inRootFrame; //Beam. L = llGetLinkPrimitiveParams(link_box2,[PRIM_ROT_LOCAL, PRIM_POS_LOCAL]); rotation rotRoot2Beam = llList2Rot(L,0); vector posRoot2Beam = llList2Vector(L,1); rotation newrotRoot2Beam = rotRoot2Body * rotClick_inRootFrame; vector offsetBeam_inRootFrame = posRoot2Beam - posRoot2Axis; vector newoffsetBeam_inRootFrame = offsetBeam_inRootFrame * rotClick_inRootFrame; llSetLinkPrimitiveParamsFast(1,[ PRIM_LINK_TARGET,link_box1,PRIM_ROT_LOCAL,newrotRoot2Body,PRIM_POS_LOCAL, posRoot2Axis + newoffsetBody_inRootFrame, PRIM_LINK_TARGET, link_box2,PRIM_ROT_LOCAL,llEuler2Rot(<-90,0,0>*DEG_TO_RAD)*newrotRoot2Beam,PRIM_POS_LOCAL, posRoot2Axis + newoffsetBeam_inRootFrame]); } I would be grateful for some help as some day i am going to have to explain this myself :)
  9. Hello All, I have a linked prim that I am trying to rotate about an axis that is not through its origin. I wanted this to happen as smoothly as possible, but I want to make sure that the way I am attempting to accomplish this is actually not possible versus me just doing something wrong. I tried llSetKeyframedMotion, but then realized you can only use this on the root prim. I was then experimenting with llTargetOmega, but couldn't figure out how to move the axis such that it doesn't originate at the origin. My wife (the creator of this linked object) has also tried moving the origin to the required point in Blender, but after a ton of digging we've discovered that due to many reasons, this is not possible (without a complicated process to "trick" the SL uploader) when the object is uploaded into SL. Here's my question: Is it true that my only course of action here is to use a timer event and move the rotation position in increments with the method discussed in the "Rotation" page of the wiki on how to move the rotation axis ("Rotating Vectors")? Is there another method I'm not thinking of? Or am I using the previously mentioned functions incorrectly/not understanding how they work? Thanks!
  10. Hi Try as I might I have to admit that I will never understand the maths or the geometry behind anything other than 'degrees' of rotation along three axis in SL. I say this upfront in case anyone tries to explain underlaying concepts to me! Keep it simple (because I'm) stupid (when it comes to this stuff). I have a script rezzing a flattened square prim with an image on it's front-most face that rez's against a wall I have provided. I have it working so it functions no matter which compass point the wall faces. However what I'd like to do is have it's orientation on one axis randomly oriented when it rezs. Imageine a poster that might be upside down, sideways, or any other of the 360 available angles. So the bones of what I'm working with is here: It's the object's own Z axis I need to spin. Everything I try seems to cause complex interactions and rotate the prim on more than one axis. Take the first line for example. If I change any of the 4 parameters, the object will rez skewed on at least two axis. I have spent hour (and hours...) on this and would be so grateful to know at what point I can inject values between 1 & 360 to have the object still flat against the wall but rotated some - like clock hands for example. Thank you!
  11. I have a problem rotating a prim, I found some examples, but in the example, explain to rotate the prim in one of the 3 axes. I need the prim to rotate (up or down) always in front. The front would be the coordinate E on the world map and zero rotation on first rez. Thanks
  12. Angle relative to a fixed point in the world Hello, is it possible for me to find out which angle to follow to get to a fixed point in the world? Something like the image below ..
  13. Hello! a friend of mine asked me a puzzle. How to make the object rotate or move along a certain path (circle)? there will be several such objects (dancepads - one script for each pad...), but the main problem - they cannot be linked to anything! I read somewhere that it is possible to specify the coordinates and the object will move from point to point. how to do it and is there any other way? As example - solar system.
  14. Somehow I thought this would be easy, but I am still struggling with some rotation things (what's new lol). I am building a positioning HUD. This HUD needs to position me an exact distance left or right of a target-avatar. My rotation is not important (as i understood that a HUD cant rotate me after positioning). The id of the target avatar is known by using llSensor. The positioning of the target is, of course important. My question is how can I determine if I am standing somewhere left or right of my target-avatar (I can be standing in front of the or behind it), and after that positioning myself that exact distance left or right of my target? Thanks in advance for your help, Trivis
  15. Hello, I've been having problems more recently with pelvis rotations within blender & using avastar. I have made roughly over 500 animations in the past using the same program/plugin versions and I have never seen this happen before. What happens is when the pelvis is rotated with curves; the entire body of the avatar jolts once it is in SL, otherwise it looks perfectly fine in Blender. Here is what it looks like in Blender: https://gyazo.com/e745e52fc1abfad26dcec32c47c71001 and here is what it looks like once it is imported into SL: https://gyazo.com/c056342957fff3b2122b3441ab103532 As you can see, there is a major problem here, and I'm thinking maybe it's a problem with SL itself. I always export and upload in .anim format. The animation is running at 30fps (iv'e tried slower) and iv'e also tried exporting it with other settings, like; use translations.Also I had the avatar enabled with IK's set to 1.0. I even tried moving the avatar in certain positions from the origin, with still no luck. Has anyone at all got any idea why this is happening? I'm surprised no one else has reported this that I have not seen. Any input is deeply appreciated. This issue is basically showstopping my work. Versions used and tested: Avastar 1.0/Blender 2.69 and Avastar 2.5.1/Blender 2.79 Viewers tested on: Firestorm, Second Life Viewer - Kylie Remsen @ Silent Motion
  16. i know i know how to do this... sorta. but i can't seem to figure it out. okay, i'm trying to ray cast from an attachment, and i want to get the spot straight down from the center of my avatar (easy, thats llGetPos and lower the z coordinate), and "ahead" of my avatar. which i know is local pos + x, BUT... to get that in region coordinates, compared to which way my avatar is facing, i need to use (i think??) Rot2Fwd. i'm just... not sure where/how? vector fwd = llRot2Fwd( llGetLocalRot() ); vector targetPos = llGetPos() + (fwd* ht); this is from the example on the wiki page... http://wiki.secondlife.com/wiki/LlRot2Fwd it says 'to move an object 5 meters on its forward axis.' in this case i'm moving it "ht" meters on its X axis. or... not MOVING it, but getting a coordinate that is supposed to be ht meters ahead of where i am. but when i face the Y axis... i'm not getting a change in the Y axis calculation? :/ no. i changed 'ht' to 10 meters, but only the x coordinate is ever changing. it's been a long day...
  17. Hello! Is it possible to alter the script of the aviation speedometer, showing the horizontal speed in the speedometer, showing the vertical speed by rotating the texture?
  18. I came across Quaternions in Second Life and after a struggle to understand them gave up. But, after looking at this video just once (so far) an understanding has begun to dawn. So i thought I would offer it to others who have stumbled onto SL's Quaternions as a path to understanding them: Youtube, Quanta. However, I have not yet achieved Quaternion nirvana. I'm still working on transferring the above to SL and Blender implementations. But.... Progress!!
  19. Hello, please help with the script. I make a speedometer and a compass and I decided to make them square planes. Script uses llSetLinkPrimitiveParamsFast. I got this texture repeats on corners. I decided to reduce the scale a little and leave a blank space on the sides so that when rotating at the corners the texture does not repeat. But I need to set the zoom. What do I need to add to this line to make it happen? Thanks a lot for any help. if(COMPASS_PRIM) llSetLinkPrimitiveParamsFast(COMPASS_PRIM, [ PRIM_TEXTURE, 1, "32865340-5893-3e24-c4a0-b511d39246c3", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, PI_BY_TWO]); ..................................................................... llSetLinkPrimitiveParamsFast(COMPASS_PRIM, [PRIM_TEXTURE, 0, "c6a241dd-709a-bf10-e7d0-b2bf49930d2a", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, our_direction_angle_rad * -1]);
  20. Using the official SecondLife viewer, is there a way to set my controls so that when I press left or right to turn my avatar, they continue rotating more than 1/16th of a rotation before the rotation drastically slows down? This makes it very, very difficult to walk around.
  21. I built a mesh house all linked and I placed scripts in the doors. When the door is touched the camera moves making it appear like you were bumped. I tried changing scripts and its still doing it. I changed the doors and its still doing it. I'm so confused, I've never had this happen before in one of my builds.
  22. I have a script that I've been using on a drawbridge that works great. Then I moved the drawbridge to a new location and the bridge is reorienting itself to North - South whenever it is operated. I'm assuming something is wrong with my math in the orientation function. I'm hoping that someone can pinpoint what it is for me... thank you in advance. Here's is my orientation function that I'm using... rotation slerp(rotation source,rotation target,float amount) { return llAxisAngle2Rot(llRot2Axis(target/=source),amount*llRot2Angle(target))*source; }
  23. Hiya folks -- I have a large pendulum and am using the Dora Gustafson, Studio Dora swing script (below) from the outworlds script library. The text prims are set up and linked as such: pendulum (cube prim, tapered at the bottom), then a cylinder stretched out on z that acts like a rod and at the top, a small cube that is the root and contains the swing script. it works okay, i had to adjust the angle and the steps in the swing script to decrease the swing angle and slow it down -- well, it works mostly okay, it can be kinda jerky every now and then but I can live with that for now. What I'd like to do next is to rotate the root cube so the pendulum continues to swing but via the root, will also slowly rotate within a circular space on the ground so that if you attached a pencil to the pendulum end, it would act like a kind of spirograph. Not sure how to incorporate the rotation of the root prim into the swing script. I plopped in a target omega line of code but it didn't do anything - I'm guessing because I have no clue what I"m doing and that I read somewhere and can't find it there is a specific target omega for physical objects. (?) in an absolutely perfect world, the swing script would also randomly change the angle so that would alter the length of the path / lines. Appreciate any help. Thank you! This is the swing script: // :SHOW: // :CATEGORY:Pendulum // :NAME:Pendulum // :AUTHOR:Dora Gustafson, Studio Dora // :KEYWORDS: // :CREATED:2015-11-24 20:38:39 // :EDITED:2015-11-24 19:38:39 // :ID:1094 // :NUM:1870 // :REV:1 // :WORLD:Second Life // :DESCRIPTION: // Will swing a prim like a simple pendulum pivoting at an axis parallel to the prim's Y-axis // :CODE: // Pendulum motion by Dora Gustafson, Studio Dora 2012 // Will swing a prim like a simple pendulum pivoting at an axis parallel to the prim's Y-axis // The pivot axis will be at the top of a prim with the Z-axis pointing up // Quote from http://en.wikipedia.org/wiki/Pendulum_(mathematics) // • A simple pendulum is an idealization of a real pendulum using the following assumptions: // • The rod or cord on which the bob swings is massless, inextensible and always remains taut; // • Motion occurs only in two dimensions, i.e. the bob does not trace an ellipse but an arc. // • The motion does not lose energy to friction or air resistance. // The periode time increase with the Z dimension (the pendulum length)... // If it is too small the motion will not be well because of the time limitation with Key Framed Motions // The parameters set in the script works nice with a 3m long pendulum // If the pendulum is moved, rotated or resized the script must be reset to update the motion float angle=1.0; // max swing from resting (radians) //I CHANGED THIS TO 0.35 float steps=12.0; // number of Key Frames //I CHANGED THIS TO 48.0 float step=0.0; list KFMlist=[]; vector U; vector V; float angleU=0.0; float angleV; integer swing=TRUE; vector basePos; rotation baseRot; default { state_entry() { llSetMemoryLimit( llGetUsedMemory()+0x1000); llSetPrimitiveParams([PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]); basePos = llGetPos(); baseRot = llGetRot(); vector v1 = llGetScale(); float periode = TWO_PI*llSqrt( v1.z/9.81); float dT = periode/steps; dT = llRound(45.0*dT)/45.0; if ( dT < 0.11111111 ) dT = 0.11111111; v1.x = 0.0; v1.y = 0.0; v1 = -0.5*v1*llGetRot(); U = v1; while ( step < steps ) { step += 1.0; angleV = angle*llCos( TWO_PI*step/steps + PI_BY_TWO); V = v1*llAxisAngle2Rot(llRot2Fwd(llGetRot()), angleV); KFMlist += [V-U, llEuler2Rot(< angleV-angleU, 0.0, 0.0>), dT]; angleU = angleV; U = V; } } touch_start( integer n) { llSetKeyframedMotion( [], []); llSleep(0.2); llSetPrimitiveParams([PRIM_POSITION, basePos, PRIM_ROTATION, baseRot]); if ( swing ) llSetKeyframedMotion( KFMlist, [ KFM_MODE, KFM_LOOP]); swing = !swing; } on_rez( integer n) { llResetScript(); } }
  24. At first it seemed not too difficult to tackle the following problem, but in the end I did not manage to do it. Rotations are the story of my (second) life :-) The problem: I have an object consisting of several prims. When someone touches the object i would like to point one of the childprims to the avatar who touched the object. See attached picture. The rotation of (only!) that childprim only need to be done around in its XY-plane, so only a rotation around its Z-axis. Does anyone has a working solution? Thanks in advance for any help.
  25. Hello! Help, please, with particles. I have a script, but it always emits particles in one direction, no matter how I rotate the object. How to make the emission change the direction when the object rotates (attached or rezzed)? Is this difficult? Thank you! ---------+--------- The problem solved. Just had to use 'cone' instead of 'angle'.
  • Create New...