Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDetectedTouchPos(0));

RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
10-17-2008 09:57
Why is the detected position seem to be the opposite side of the prim?
example:
make 2 prims a small and large and conect the large one last and try this script in the main one

default
{
state_entry()
{

}

touch_start(integer total_number)
{
vector spot =(llGetPos() -llDetectedTouchPos(0));
// llSay(0,(string)spot);
llSetLinkPrimitiveParams(2,[ PRIM_POSITION,spot ] );

}
}

what do i need to do to make that ball go to the spot you touched?

Ha well just flipped it 180 on its z axis made it flat and now it seems to work seems you need to ad a get rot in there and do some complicated rotation multiplication anyone
have the formula on that?
_____________________
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
10-17-2008 10:34
Maybe:

vector spot = (llDetectedTouchPos(0) - llGetPos()) / llGetRot();
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-19-2008 00:53
Yeah, a bunch of us begged for a "local" prim-relative result for that function, but alas it is only available in "global" region coordinates. See http://jira.secondlife.com/browse/SVC-1902
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
11-21-2008 08:59
Great that works. THANK YOU Qie Niangao.
I really should have taken some advanced math in school but anyway,
Can someone show me the formula to turn the prim that moves so it points to the center of the rot object? Like for a pin map on a globe?

below goes in the sphere main Prim
_________________________________________________


integer thisone;

default
{
state_entry()
{
}
link_message(integer lnum,integer num,string mes,key id)
{
thisone = (integer)mes;
}
touch_start(integer total_number)
{
vector spot = (llDetectedTouchPos(0) - llGetPos()) / llGetRot();
count = thisone;
llSetLinkPrimitiveParams(count,[ PRIM_POSITION,spot,PRIM_ROTATION,llGetRot()] );

// llGetRot() is the part I need help on above I know llGetRot is wrong
// it needs to rotate so the bottom or top of the child shpere points to the
//center of the main prim . been trying random this * that and stuff but one of
//you probably knows the formula. Can someone help please TY
}
}
__________________________________________________

the below goes in the child prims
so you touch the child prim then the main prim
the child prim is a sphere that's been dimpled so far it forms a cone
reset all the scripts before touching

_________________________________________________

default
{
state_entry()
{
llSetObjectName((string)llGetLinkNumber());
}
touch_start(integer total_number)
{
llMessageLinked(LINK_ROOT,0,llGetObjectName(),"";);
}
}
_____________________