Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

object follows and rotates with object

Mattias Faulkner
Registered User
Join date: 22 Sep 2005
Posts: 5
11-20-2005 17:25
looking for a train wagon type script, basically objects following and rotating with the direction of the first one kinda thing. ive got a simple follow script which i have converted to follow objects rather then the owner, but theres no rotating, and the distance is set to a differencein coords, which is probably not gonna give me the right results, heres what ive got.

default
{
state_entry()
{
vector pos = llGetPos();
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_PHYSICS, TRUE);
llSleep(0.1);
llMoveToTarget(pos,0.1);
llSensorRepeat("n1",NULL_KEY,7,20,PI,.25);
key id = llDetectedKey(0);

}

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
vector offset =<0,-1.2,0>;
pos+=offset;
llMoveToTarget(pos,.1);
}
}


Any advice or different solutions would be vrey much appreciated :)
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-20-2005 19:13
From: Mattias Faulkner


Any advice or different solutions would be vrey much appreciated :)


your follow script looks good. what I would do is get the key of of each car in then have the llLookAt command set to the appropriate key for proper rotation.