Difference between revisions of "Talk:LlDetectedTouchUV"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
;Offsets and repeats need to be clarified
=== Discussion ===
 
This topic was recently discussed on Jira at {{JIRA|SVC-8090}}.
 
=== Offsets and repeats need to be clarified ===
If someone would please look at the following with an editor's eye, I'd like to add this clarification to the page. Should there also be an example of how offsets can make the results be offset?
If someone would please look at the following with an editor's eye, I'd like to add this clarification to the page. Should there also be an example of how offsets can make the results be offset?



Revision as of 07:42, 7 August 2012

Discussion

This topic was recently discussed on Jira at SVC-8090.

Offsets and repeats need to be clarified

If someone would please look at the following with an editor's eye, I'd like to add this clarification to the page. Should there also be an example of how offsets can make the results be offset?

llDetectedTouchUV returns the U,V corresponding to the part of the texture touched, plus any U and V index of tiled repeats. For example, if you set two repeats vertically and one horizontally, with no texture-offset and no texture-rotation, clicking in the middle of the upper half yields <1.5,0.5,0.0> and clicking in the exactly same spot on the lower copy of the texture, i.e. the middle of the bottom half, yields <0.5,0.5,0.0>. Thanks to this feature, one can determine not only where on a texture the touch was detected, but on which repeat of the texture, in case that matters.

The position touched on the texture, ignoring repeats and/or determining which repeat, is determined thusly: <lsl> vector DTUV=llDetectedTouchUV(index); vector position_on_texture = <DTUV.x - (float)llFloor(DTUV.x), DTUV.y - (float)llFloor(DTUV.y), 0.0>; list which_repeat = [ llFloor(DTUV.x), llFloor(DTUV.y) ]; </lsl> Windy Schor 18:08, 6 August 2012 (PDT)