Xiija Posted March 25, 2015 Share Posted March 25, 2015 so,i have an artcar rezzer, i'm trying to get it to rez many different shape.size cars.since the rezzer has no idea of the size of the object being rezzed,i've tried to use boundingbox and getpos,llGround() etc to make sure all cars rez about1M off the ground....(script inside the cars)i can't figure the math to check the root position vs the center of the linkset position in relation to the ground? thanks for any helpX. ETA: i just used a 15M set pos and llMoveToTarget :P Link to comment Share on other sites More sharing options...
arton Rotaru Posted March 25, 2015 Share Posted March 25, 2015 Make em physical and let them fall down. :matte-motes-tongue: This should set the cars on the ground, as long as the root isn't rotated awkwardly. I prefer raycasts to detect the surface underneath. Works on prim surfaces also, not only on terrain. default{ touch_start(integer total_number) { list lBB = llGetBoundingBox(llGetKey()); vector vSize = llList2Vector(lBB, 1) - llList2Vector(lBB, 0); vector vCenter = (llList2Vector(lBB, 0) + llList2Vector(lBB, 1)) * 0.5; vCenter.z -= llFabs(vSize.z * 0.5); vector vStart = llGetPos() - <0.0, 0.0, llFabs(vCenter.z)>; list lRC = llCastRay(vStart, vStart - <0.0, 0.0, 15.0>, [RC_REJECT_TYPES, RC_REJECT_AGENTS|RC_REJECT_PHYSICAL, RC_MAX_HITS, 1]); if (llList2Integer(lRC, -1)) { llSetRegionPos(llList2Vector(lRC, 1) - <0.0, 0.0, vCenter.z>); } }} Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 25, 2015 Share Posted March 25, 2015 Make a script that sense your cars when rezzed in position Let it record positions and rotations Use those later to rez your cars the way they were That's what I do :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Life Camino Posted March 26, 2015 Share Posted March 26, 2015 Let me suggest this approach, because it has worked well for me in the past: Use a script to record the position and rotation of the cars relative to the rezzer and then use an on_rez event to trigger the car to move to that relative position when it is rezzed. I use a positioning script to do the job: integer crate_channel=-14200;integer crate_listen_handle;integer count;vector rez_pos;vector my_pos;vector owner_pos;vector offset;rotation my_rot;rotation owner_rot;default{ state_entry() { string crate_name = llGetObjectName(); if (!~llSubStringIndex(crate_name, "VEHICLE")) { crate_name = "VEHICLE " + crate_name; } // crate_name = llGetSubString(crate_name, 0, 28); llSetObjectName(crate_name); owner_pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0); my_pos = llGetPos(); my_rot = llGetRot(); offset = my_pos - owner_pos; llMessageLinked(LINK_THIS, TRUE, "AVRS_MENU", ""); } on_rez(integer start_param) { if (start_param > 0) { llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llMessageLinked(LINK_THIS, FALSE, "AVRS_MENU", ""); crate_listen_handle = llListen(crate_channel,"","",""); owner_pos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]), 0); owner_rot = llList2Rot(llGetObjectDetails(llGetOwner(), [OBJECT_ROT]), 0); llSetRot(my_rot * owner_rot); llSetRegionPos(owner_pos + offset*owner_rot); } else if (start_param == 0) { state default; } } listen(integer channel, string name, key id, string message) { if (channel == crate_channel && llGetOwnerKey(id) == llGetOwner()) { if (message == "CLEAR_VEHICLE") { llMessageLinked(LINK_THIS, 0, "AVRS_CLEAR", ""); llMessageLinked(LINK_SET, 0, "POOFER",NULL_KEY); llSleep(2.0); llDie(); } if (~llSubStringIndex(message, "POOF_START::")) { llMessageLinked(LINK_THIS, 0, message, id); } if (~llSubStringIndex(message, "POOF_END::")) { llMessageLinked(LINK_THIS, 0, message, id); llMessageLinked(LINK_SET, 0, "POOFER",NULL_KEY); llSleep(2.0); llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); llMessageLinked(LINK_THIS, 0, "AVRS_REZ", ""); llMessageLinked(LINK_THIS, TRUE, "AVRS_MENU", ""); } } } } I use the script, above, to position vehicles relative to my avatar when the vehicles are rezzed from a HUD. It also works with Horizons scene crates and can trigger an on-rez poofer effect. You may not need all that; but, I hope this helps. Link to comment Share on other sites More sharing options...
Life Camino Posted March 26, 2015 Share Posted March 26, 2015 Thanks, for that bit of code, arton. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now