Jump to content

Quistess Alpha

Resident
  • Posts

    3,698
  • Joined

  • Last visited

Reputation

4,012 Excellent

Retained

  • Member Title
    Qui(ll)+(Prie)stess, but you can just call me Tessa.

Recent Profile Visitors

3,817 profile views
  1. I thought I mentioned this in my rambles above, but I'm not finding it in a brief skim, and it's conceptually important: Vectors can represent both positions in-world, and global changes to position. To 'apply' a change to a position in-world, you simply add a change vector to a position vector, and set the position of something to that new position. For example: llSetPos(llGetPos()+<1,0,0>); // move 1 unit in the x-direction. Rotations can be used in a similar way, but with a few important differences: rotations are less trivial to express on their own. One of the best ways of creating a rotation 'from scratch' is to use llAxisAngle2Rot() rotations are multiplied instead of added together. the order of multiplication matters. that last point can be confusing at first, but once you understand what each order does, it can be very useful: In LSL, when you multiply in the order orientation*change, you rotate around the world x,y,z axes (like you would see when editing an object with 'snap world' checked); when you multiply in the order change*orientation, you rotate around the object's intrinsic axes (like you would see when editing an object with 'snap local' checked) As a practical example, say you're scripting something like a turret that can aim up and down and move left and right. To aim up you might use something like llSetRot(llAxisAngle2Rot(<0,1,0>,-15*DEG_TO_RAD) * llGetRot() ); // apply local rotation on y axis to move the gun up around its y axis, independent of whatever direction it's facing, but to aim left/right you would use: llSetRot(llGetRot() * llAxisAngle2Rot(<0,0,1>, 15* DEG_TO_RAD) ); // apply global rotation on z axis Of course, for an actual turret, you might want to apply the rotations to different links, but the same principals apply.
  2. It shouldn't be impossible to do what you're looking for, or even particularly difficult, but yeah, there's really no telling what no-mod scripts might be doing. you'd probably need/want something written from scratch. I would actually recommend 3 prims, the first or "root" prim defines the center of rotation for llTargetOmega(). if an avatar sits on the root prim while it's spinning and the sit-target doesn't have a large offset, they will spin in place like a balerina, which doesn't sound like what you want. You can of course set a different offset in the script, but for things like this, I usually find it's easier to change the position and rotation of a prim than to get your head around the numbers in the script.
  3. The 'correct' solution is to add extra prims to your object, one for each person who is going to sit on it, and then use llLinkSitTarget() to set a sit target for each of the prims, for example: default { state_entry() { // optionally prevent avatars from sitting on the root prim rather than designated seats: llSetLinkPrimitiveParamsFast(1,[SCRIPTED_SIT_ONLY,TRUE]); llLinkSitTarget(2, <0,0,0.1>, ZERO_ROTATION); llLinkSitTarget(3, <0,0,0.1>, ZERO_ROTATION); // if more sit target prims, repeat similarly. . . } } then, when sitting on the link, avatars will sit with an orientation and position determined by the rotation and position of the new prims. editing the prims while an avatar is seated on it will NOT adjust the seated avatar, to make adjustments with this method, the avatar has to stand up and sit back down after any change. -- A less correct solution would be to make sure you are 'outside' (not within the convex hull of some mesh or prim) and make your single prim something relatively large that 'looks like' it has room for more than one person to sit on. Sitting without designated sit-targets is possible, but IMO rather fiddly.
  4. As far as I know, the only way to set the default attach point is to actually attach to an avatar. Closest thing would be to llAttachToAvatar (NOT the temp version, which would destroy the object) then llDetachFromAvatar immediately after attached in the attach() event. Unfortunately it is also impossible to 'drop' (detach, then rez self on ground) an object via script. <technical meandering> It's probable that 'default attach point' is a property of inventory assets, and not the actual objects themselves, which would mean setting it without it being attached would be basically impossible to implement. </technical meandering>
  5. This was kinda fun to think through. integer within_hull(vector test, list points) { integer ind_a= 0; integer ind_b= 1; integer ind_c= 2; // indexes for 3 points from points. vector a = llList2Vector(points,ind_a); vector b = llList2Vector(points,ind_b); vector c = llList2Vector(points,ind_c); integer len = llGetListLength(points); // for all pairs of 3 points a,b,c: while(ind_c<len) { vector normal = (b-a)%(c-a); integer side = (test-a)*normal >0; // on which side of the plane defined by a,b,c is test? integer outside = TRUE; //early return variable. integer ind_p = len; // for each other point p: while(~--ind_p) { if(ind_p!=ind_a && ind_p!=ind_b && ind_p!=ind_c) { vector p = llList2Vector(points,ind_p); if( (((p-a)*normal)>0) != side) { //llOwnerSay("point del"); // p is on opposite side from test: // remove it from list. points = llDeleteSubList(points,ind_p,ind_p); // fix indexes! --len; if(ind_c>ind_p) --ind_c; if(ind_b>ind_p) --ind_b; if(ind_a>ind_p) --ind_a; }else { // it is possible test is within points: outside = FALSE; } } } if(outside) // there were no points on the same side of a,b,c as test, therefore it is impossible it is within the cloud: { return FALSE; } // set indexes for next loop: if((ind_a+1)<ind_b) { a = llList2Vector(points,++ind_a); }else { a = llList2Vector(points,ind_a=0); if((ind_b+1)<ind_c) { b = llList2Vector(points,++ind_b); }else { b = llList2Vector(points,ind_b=1); c = llList2Vector(points,++ind_c); } } //llOwnerSay("Debug: "+llList2CSV([ind_a,ind_b,ind_c])); } // either the initial point list had fewer than 4 points, or test is within the convex hull: return TRUE; } default { touch_start(integer total_number) { // for debug, determine if this object is within the convex hull of all nearby objects named "Test Point" llSensor("Test Point","",PASSIVE,7.0,PI); } sensor(integer n) { llOwnerSay("Found "+(string)n+" test points."); list points; while(~--n) { points+=llDetectedPos(n); } integer inside = within_hull(llGetPos(),points); if(inside) { llOwnerSay("Within hull!"); }else { llOwnerSay("Out of bounds!"); } } } I'm pretty sure it works, but I didn't test it super rigorously.
  6. As long as we're bringing up the dead, you can also do it with a media face. Media 'knows' where you're touching if you've touched it once to let it grab your mouse. I know I posted a demo long time passing. . . but easier to find it in my inventory than on the forums so. . . Too complicated for a simple use-case like in the OP, but it's a fun proof-of-concept.
  7. Not to toot my own horn, but the tv script I wrote (see above) is a minimally viable example of doing exactly that (pause/restart, or skip back/forward all resync everyone.). As for how to do that with any other specific product. . . do they have a support group or anything?
  8. Something something, scripting forum isn't the place to ask for custom scripts etc. etc. but I was bored, so. . . (quote reduces spaminess)
  9. Since I haven't read the movie or watched the book in years, I looked it up. The Harry potter wiki says: On its face, seems like a rather simple idea, but there are a lot of fiddly nuances depending on exactly how you'd want it to work. I don't know of anywhere in-world that would magically have exactly what you're looking for.
  10. AVsitter uses notecards to store pose information; in the case of things that advertise 1000+ animations, that can take a lot of time to read in and process.
  11. llGetRegionList returns up to 100 avatars, in no sensible order; Sensor only up to 20 or so, and sorted by distance. In the (extremely unlikely) case that there are over 100 agents in the region, you may fail to find one even if it's right in front of you.
  12. not directly, you have to do math, but assuming the object has a flat face (like a cube), with sane texture mapping, the math wouldn't be too bad. for your use-case (I'm envisioning something like a dartboard) just converting the region coordinates to object coordinates should be sufficient? (hit_pos-object_pos)/object_rotation; for a cube, could then divide that by half the object's scale, (component wise, <a.x/b.x, a.y/b.y, a.z/b.z> ) then the coordinate that is almost exactly +- 1.0 would tell you the face, and the other two coordinates the position on the face in coordinates ranging from -1 to +1 with 0,0 being the center.
  13. modulus by 0 (and maybe also 1?) has bitten me a few times. You could argue it's divide by zero in disguise, but it's a good disguise to look for.
×
×
  • Create New...