Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I need my wolf to follow me and look at me like I'm it's master, yo

CharlieFinlayson Humbridge
Registered User
Join date: 17 Nov 2009
Posts: 3
11-18-2009 04:59
default
{
state_entry()
{
vector pos = llGetPos();
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_Z, FALSE);
//llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE);
llMoveToTarget(pos,0.4);
// Look for owner within 20 meters in 360 degree arc every 5 seconds.
llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI, 2.0);
}
sensor(integer total_number)
{
// Get position of detected owner
vector pos = llDetectedPos(0);
// Offset back one metre in X and up one metre in Z based on world coordinates.
vector offset =<-1,0,0>;
pos+=offset;
llMoveToTarget(pos,0.4);

list personPos = llGetObjectDetails(llDetectedKey(0), ([OBJECT_POS]));
vector personPos1 = llList2Vector(personPos,0);
llLookAt(personPos1,3.0,1.0);
llSleep(0.5);
llSetPos(personPos1);

}

}

Currently, he's just falling me around like a total gimp, and looking down at the ground all the time. Can someone tell me what I'm doing wrong in my script and how I can correct it? I don't even fully understand what is going on, I mostly took it off the Wiki.

Thanks for any advice.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
11-18-2009 08:16
that's because you're using llSetPos and llLookat with the same position, when you do that it gets unpredictable movements when trying to "look at itself"

this may work, but you'll probably need to add some negative offset to the z axis so it still moves along the ground rather than directly behind you with its center at your center

CODE

default
{
state_entry()
{
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_Z, FALSE);
//llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE);
llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI, 2.0);
}

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
pos += < -1,0,0 >;
llMoveToTarget(pos,0.4);
vector mypos = llGetPos();
llLookAt(< pos.x,pos.y,mypos.z >,3.0,1.0);
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369