Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llLookAt script is bjorked.

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-14-2005 16:27
I'm trying to have a prim look at a global coordinate based on it's own global coordinates. The point in question is just a random one I picked in my home, but the script is broke on both extremely large and small distances: it's rotating at some wierd angle even when I give a basic <1,0,0> vector (should be pointing straight along the X axis). it *appears* to be pointed at <-0.1,-0.2,-0.3> any suggestions as to what's going wrong?

**wierd bugs when attatched**

when I'm attatched and "walking" my avatar's knees are at ground level and if I stand still there's a very very slight rotation on what appears to be a random axis. also there is no rotation of the prim what so ever while it's attached

here's what I have so far

CODE


// Strength and damping are values used to control how llRotLookAt and llLookAt move, these values are tunable.
float strength = 1;
float damping = 1;
vector testwaypoint = <1,0,0>;//this is a test waypoint which is just used for the sake of having a value currently
vector waypoint = <255307.34375,261596.81250,101.00049>;
default {

state_entry() {
llSetTimerEvent(.1);


}

timer()
{
vector gposition = ( llGetRegionCorner()+llGetPos() ); //global position of the prim.
vector target = (waypoint - gposition); // A vector to look at.
llLookAt(target, 1, 1);
llSetText("Current Location: "+ (string) gposition + "\nWaypoint: " + (string) waypoint + "\nVector I'm pointing at :" + (string) (waypoint-gposition) + "\nDistance:" + (string) (llVecDist(waypoint, gposition) ),<1,1,1>,1); //Debugging info

}


}



BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
11-14-2005 21:45
I think the vector argument for llLookAt() is in region coordinates. Try
CODE
llLookAt(waypoint - llGetRegionCorner(), 1, 1);
instead.