integer llDetectedTouchFace( integer index );
Forced delay: 0.0 seconds. Energy: 10.0.
index does not support negative indexes.
For the touch category of events only. The prim that was touched may not be the prim receiving the event, use llDetectedLinkNumber to check for this; likewise you can use llDetectedTouchFace to determine which face was touched.
Returns an integer that is the index of the face the avatar clicked on.
// This is the essential script to drop in a prim when you need to ascertain the number of a face (or faces)
// Touch the prim surfaces to learn their face numbers, which you can then use in other scripts for texturing, colouring etc.
say(string message)
{
llSay(PUBLIC_CHANNEL, message);
}
default
{
touch_start(integer num_detected)
{
integer face = llDetectedTouchFace(0);
if (face == TOUCH_INVALID_FACE)
// {
say("The touched face could not be determined");
// }
else
// {
say("You touched face number " + (string) face);
// }
}
}
default
{
touch_start(integer num_detected)
{
integer link = llDetectedLinkNumber(0);
integer face = llDetectedTouchFace(0);
if (face == TOUCH_INVALID_FACE)
llSay(PUBLIC_CHANNEL, "Sorry, your viewer doesn't support touched faces.");
else
{
// store the original color
list colorParams = llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]);
vector originalColor = llList2Vector(colorParams, 0);
// color detected face white
llSetLinkColor(link, <1.0, 1.0, 1.0>, face);
llSleep(0.2);
// color detected face black
llSetLinkColor(link, ZERO_VECTOR, face);
llSleep(0.2);
// color detected face back to original color
llSetLinkColor(link, originalColor, face);
}
}
}