Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
11-14-2005 06:23
***Complete Rewrite to clarify what I'm trying to do***
I'm trying to make a HUD attachment point along a specified vector, which needs to be calculated by comparing the center of the prim with a set of global coordinates ( I want it to look at a specific spot in the world which may cross sim boundaries, not one relative to the prim). I was hoping to use the llLookAt command to do the actual rotation of the object, but it's been a long while since I've done any kind of vector mathematics and I don't know how to calculate a vector based on two coordinates. (namely the root prim's global coordinates and the specified global coordinates).
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
11-14-2005 09:58
It should be a simple matter of subtracting the global coordinates of the local region corner (using llGetRegionCorner()) from the target global coordinates to convert your target's global coordinates to the region coordinates that llLookAt() wants.
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
11-14-2005 10:44
From: BamBam Sachertorte It should be a simple matter of subtracting the global coordinates of the local region corner (using llGetRegionCorner()) from the target global coordinates to convert your target's global coordinates to the region coordinates that llLookAt() wants. let me see if I understand this correctly: to get the global coordinates of the target, I'd need to have this in my code: vector gtarget //position of the global coordinates vector gposition //position of the prim that's doing this
default { state_entry() { vector gposition = (llGetRegionCorner + llGetPos); vector gtarget = <0,0,0>; //I want this to look at the numerical 0 of the globe. but when I go to calculate the vector for llLookat, this will point towards the numerical 0 of the region, not globe.
llLookAt ( (gtarget - gposition),1,1); //Should look at the specified gtarget } }
[edit] after writing out the code, I've solved most my problems, but is there an easier way to get your global coordinates that making a prim with a script that says what it's global coordinates are?
|