04-10-2009 17:57
Saw a post earlier for this, this is tested and working, it will also work in linked objects, I added a llStopLookAt() to no_sensor() event to help with lag.

CODE

default
{
state_entry()
{
llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
}
sensor(integer total_number)
{

vector pos = llGetPos();
vector target = llDetectedPos(0);

target.z = pos.z;

llLookAt(target, 3,1);
}
no_sensor()
{
llStopLookAt();
}
}



note: this looks like almost every other one of these scripts out there, only thing different is the no_sensor(), the example on the wiki for llLookAt is nearly identical to this but does it with less lines of code, and makes a little more sense as the coding isn't as terse.