|
Christif Vaher
Registered User
Join date: 24 Jun 2008
Posts: 51
|
04-01-2009 10:25
The "Library: Simple follow script for pets or other objects" /54/f3/283643/1.html works great except for one small thing... The bottom face of my prim points towards my agent versus the side face. How do you make it so the "pet" stays upright and their "face" or side prim points to the agent versus their feet ? Here is the code for easier reference: vector offset =<-1,2,1>;
startup() { vector pos = llGetPos(); llSetStatus(STATUS_ROTATE_Z,TRUE); llSetStatus(STATUS_PHYSICS, TRUE); key id = llGetOwner(); llSensorRemove(); llSensorRepeat("",llGetOwner(),AGENT,10,2*PI,.1); }
default { state_entry() { startup();
}
on_rez(integer start_param) { startup(); }
sensor(integer total_number) { vector pos = llDetectedPos(0); llMoveToTarget(pos+offset*llDetectedRot(360),.3); llLookAt(pos, .1 , 1); } }
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
04-01-2009 10:35
This is not a follower just a simple 'point at'. Should be simple enough to modify and use with a follower. vector lookat; // coordinates of point to look at default { state_entry() { llSetRot( llRotBetween( < 1.0, 0.0, 0.0 >, llVecNorm(lookat-llGetPos()))); }
moving_end() { // refresh after move llSetRot( llRotBetween( < 1.0, 0.0, 0.0 >, llVecNorm(lookat-llGetPos()))); } }
the program will point the X axis toward the point Use < 0,1,0 > for the Y axis and < 0,0,1 > for the z axis
_____________________
From Studio Dora
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-01-2009 19:27
or just rotate the root prim so it's relative to the sim (my guess is your root is tilted so that +X was facing regional -Z... heck I'd even guess it was a sphere)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|