Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

DetectedTouchPos to World w/ Rotation (llLookAt)

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
02-08-2010 08:58
heyas!

okay, somebody gave me a script that has 2 prims... the root prim is a sculpty and when you click it, the 2nd prim points at the spot you clicked and shoots particles out from right there. it's pretty clever, and works great! except.......!

if its rotation is not all zero.

you turn this thing, its particle shooter gets lost.


okay, so the detectedtouchpos returns a point in 3d space, and then he has the particle shooter do llLookAt that vector. how can that 3d point be manipulated to be accurate for llLookAt with the object rotated? i know somebody on here told me once upon a time how to calculate a point with rotation, but for the life of me, i can't remember... oh, maybe its in one of the old edge rotate threads....
http://forums.secondlife.com/showthread.php?t=276049

okay, i hope that's not the same thing, because i STILL have no idea what deanna is trying to tell me in that thread :X


okay, as far as i can tell... the detected pos is giving the correct world coordinates for where i click the object (because it also rezzes something at those coordinates). but when the child prim tries to 'look' at it.... for some damfool reason, it is offset.

annnnnd, apparently it's something fubar in the lllookat for child prims because no matter which way i turn this thing it IS giving the proper coordinates that i'm touching. ::sigh::
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
02-08-2010 10:01
Can you post the script?
_____________________
.
:) To contact forum folks, join the inworld group "The Forum Cartel". New residents with questions about SL more than welcome! We has parties!

:) To contact forum scripters, join the inworld group "Scriptoratti" (thanks Void!). New scripter questions welcome!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-08-2010 10:26
(lookatPos - sculptPos) * llGetRot() + sculptPos

I think

ETA:
whopps no... I see the problem now.. it's the child prim... you need to divide out the roots rotation, possibly from the childs position, or the roots position I can't be sure. SVC-93 should not come into play.

ETA2:
just saw the sig Nika, love it (and thank you)... too bad forums archives aren't likely to display them =(
_____________________
|
| . "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...
| -
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
02-09-2010 04:17
I knew I remembered seeing this discussed before, and I've managed to find it at /54/89/334263/1.html. It seems to do the trick with regular prims and the very few sculpties I've tried. It's a starting point, anyway.

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)
{
llRezObject( "Object" ,
llDetectedTouchPos(0) + offset*llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, -llDetectedTouchNormal(0) ),
ZERO_VECTOR,
llAxes2Rot( ZERO_VECTOR,ZERO_VECTOR, (llDetectedTouchNormal(0)) ),
0 );
}

}