Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotation of polygon with llDetectedTouch?

Sunoo Oddfellow
Registered User
Join date: 16 Sep 2005
Posts: 3
08-09-2009 12:05
Hey, on the beta grid I saw somebody script a sculpted prim so you can put pins into it by clicking on it. The pins would stick out from the sculpted prim based on where you clicked it. They'd always stick outward. I've been trying to figure out how to do something like this myself, but I haven't had any luck. Does anybody know if this is possible on the main grid? I haven't been able to find anything like this.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-09-2009 12:51
as for the position, i'm sure they're using llDetectedTouchPos.
for the rotation i'm not sure, rotations confuse me, and i don't really use many scripts that rely on rotations anyways
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
08-09-2009 12:59
It might be using llDetectedTouchNormal or one of the related touch functions.

http://wiki.secondlife.com/wiki/LlDetectedTouchNormal

http://wiki.secondlife.com/wiki/Category:LSL_Touch
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-09-2009 13:04
My head aches thinking of the math. Offhand, I think you'd have to calculate the orientation of the surface at the point where llDetectedTouchUV is triggered and then rez a pin normal to the surface at that point and link it to the prim. That would be enough of a challenge on a standard prim, but I can't begin to imagine how to do it on a sculpty prim. Nice challenge, though.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Ante Flan
'yote
Join date: 14 Sep 2005
Posts: 46
08-09-2009 13:08
I think it might be normal, but I'm not sure how to do it with that information.
Cerise Sorbet
Registered User
Join date: 8 Jun 2008
Posts: 254
08-09-2009 13:32
Hi, here is one way to do it.

CODE

// this will rez cones and point them at the center
// of a prim when you touch it

// put a default cone in the prim inventory.
// call it "generic cone"
// it is a cylinder with x and y taper 1.0
// make it temp on rez for great justice

float gConeHeight = 0.25; // HALF the height of the cone (center to tip)

default
{
touch_start(integer total_number)
{
vector center = llGetPos();
vector touched = llDetectedTouchPos(0);

vector pinSpot = center + (llVecNorm(touched - center) * (gConeHeight + llVecDist(center, touched)));

llRezObject
(
"generic cone",
pinSpot,
ZERO_VECTOR,
llRotBetween(< 0, 0, 1 >, center - touched),
0
);
}
}
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-09-2009 14:44
hmm, i wonder what happens if you touch an avatar sitting on a prim with this script, could be a new torture device lol, guess it doesn't work with yourself cause touching yourself (sounds so dirty) while you're sat on a prim makes your cam just reset, would probably have to use a sculpted avatar shape fit to about the size of the avatar
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
08-09-2009 14:48
Here's what I came up with that looks like it works:

CODE

default
{


touch_start(integer total_number)
{
llOwnerSay( "Touched.");
llRezObject( "pointer" ,
llDetectedTouchPos(0),
ZERO_VECTOR,
llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, llDetectedTouchNormal( 0 ) ),
0 );
}

}


One would have to make allowances for the size of the rezzed object and other such complications.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-09-2009 14:53
nice suezanne, although, using the pointer from cerise's example ended up sticking in backwards with yours, i just reversed the vector gotten with llDetectedTouchNormal and got much better results with it, even with sculpties, gonna play with some more complex sculpts and see what it does

CODE
default
{


touch_start(integer total_number)
{
llOwnerSay( "Touched.");
llRezObject( "Object" ,
llDetectedTouchPos(0),
ZERO_VECTOR,
llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, -(llDetectedTouchNormal(0)) ),//here's where i changed it
0 );
}

}



someone should totally put this example on the wiki, i have no idea how to

eta:

here's the same thing with an offset

CODE

vector offset = < 0,0,0.1>;//remove the space in this vector, had to put it to post in the forum
default
{
touch_start(integer total_number)
{
llOwnerSay( "Touched.");
llRezObject( "Object" ,
llDetectedTouchPos(0) + offset*llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, llDetectedTouchNormal(0) ),//not reversed here
ZERO_VECTOR,
llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, -(llDetectedTouchNormal(0)) ),
0 );
}

}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369