Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDetectedTouch Question

Knight Nootan
Registered User
Join date: 26 May 2008
Posts: 73
07-20-2009 20:03
I was looking at the wiki and it doesn't answer all my questions. The example script used is

vector UV = llDetectedTouchUV(0);
float U = UV.x;
float V = UV.y;

So my question is if you wanted the left side of the prim face to do something and the right side to do another how would you do that.

Thanks!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-20-2009 20:31
well first off, you'l probably want to go with the ST version, instead of the UV version (UV is tied to the the texture and affected by offsets in the texture)

secondly, you would test the x portion of your returned vector... < .5 = left so...

if (U < .5){
//leftSide
}else{
//rightSide
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Knight Nootan
Registered User
Join date: 26 May 2008
Posts: 73
07-20-2009 21:16
TY Void, That makes sense and it works!
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
07-21-2009 03:06
For your stated task of left vs. right I think you want to be using llDetectedTouchST.

That said, most interfaces are dependent on the texture to define them so llDetectedTouchUV is a better choice.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Nalates Urriah
D'ni Refugee
Join date: 11 Mar 2008
Posts: 113
07-21-2009 19:41
I used this feature to make a 1 prim vendor what has several controls on the front and back (see XStreet).

I also made a little script that tells you where you touched a prim saying the face and coordinates. I says it so that it the result can be copy/pasted into an if/then in a script. You can do buttons by defining the upper left and lower right corners (if more than Upper Left and less than Lower Right then touched).

The cubes are easy to work with but much more unpredictable than you think. Also, rotating the cube does strange things to how YOU perceive the coordinates because the coords rotate with the prim. If you rotate on X or Y, it can fool you. Z rotation does not matter, unless you are trying to figure out a coord on the top or bottom face. It can get confusing, which is why I made the tool.

The surface coordinates run from 0 to 1 in the X & Y directions. The Z value is always 0 and never changes regardless of the shape or face.

The command works with sculpties too.

Remember not all viewers can handle the command. Last I checked (4 or 5 months ago) about 30 to 40% of my customers could not use Touch. I had to rethink the 1 prim vendor's operation.
_____________________
Nalates Urriah
D'ni Refugee - Guild of Cartographers