LlDetectedTouchPos
De DigiWiki.
Version du 25 juin 2012 à 23:27 par Djphil (discuter | contributions)
default { touch_start(integer pos_detected) { integer i = 0; for(; i<pos_detected; ++i) llWhisper(0, "Pos clicked: " + (string)llDetectedTouchPos(i)); } }
vector GetRealTouchPos(vector pos) { //By Ariu Arai for free use to anyone //Returns a useful HUD Position Vector from the llDetectedTouchPos(); function //USE: vector pos = GetRealTouchPos(llDetectedTouchPos(0)); .. Etc. //This function is intended to be used to move child prims to where the user clicks. This does not work on the root prim. integer point = llGetAttached(); vector offset; if(point == ATTACH_HUD_TOP_RIGHT)offset = <1, .933, -0.5>; else if(point == ATTACH_HUD_TOP_CENTER)offset = <1, 0, -0.5>; else if(point == ATTACH_HUD_TOP_LEFT)offset = <1, -.933, -0.5>; else if(point == ATTACH_HUD_BOTTOM_LEFT)offset = <1, -.933, 0.5>; else if(point == ATTACH_HUD_BOTTOM)offset = <1, 0.0, 0.5>; else if(point == ATTACH_HUD_BOTTOM_RIGHT)offset = <1, .933, 0.5>; //return (pos - llGetLocalPos()) + (offset * llGetLocalRot()); return ((offset - llGetLocalPos()) + pos) / llGetLocalRot(); }