RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
|
12-20-2005 21:39
trying to get an atachment to point at the closest av near me this is one of those usefull bits of code a lot of people could use who want to use prim eyes on there av's. also figured I'd make the eyeball have 2 pupils one pointed each way so even if the person closest to me is behind me i'll still have pupils pretty clever huh? float interval = 2; integer range = 20;
default { state_entry() { llSensorRemove(); llSensorRepeat("","",AGENT,range,PI,interval); // llSensor(0,AGENT,ACTIVE,20,45); } sensor(integer n) { integer i; vector pos; pos = llDetectedPos(i); rotation rot; // llSay(0,(string)pos); rot = llEuler2Rot(pos *<0,0,0,1>); // this part isn't working llSetLocalRot(rot); // llSay(0,(string)rot); } }}
|
Oasis Perun
Registered User
Join date: 2 Oct 2005
Posts: 128
|
12-20-2005 22:26
you are multiplying a Euler by a Rot here :: rot = llEuler2Rot(pos *<0,0,0,1>  ; // this part isn't working maybe try.. and i cant test this right now :: rot = llEuler2Rot(pos)*<0,0,0,1>; // Try this
|
Nexus Nash
Undercover Linden
Join date: 18 Dec 2002
Posts: 1,084
|
12-20-2005 23:02
RacerX, i'm guessing you want the object to lookat the avatar. What I usually use is simply the position vector from the llDetectedPos(). Also llLookAt() is centered on the Z axis, it points the Z axis towards the target.
|
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
|
12-20-2005 23:39
Ya but I couldn't get look at to work when attached. So far no winners. Nexus read the thread before posting your add. Well maybe my basic script is flawed, But if I replaced the llSetLocalRot with llLookAt(pos,2,1); it works, But not when attached, Maybe the llUeller is a bad plan, Anyway, Help me make my eyes look at stuff, If you have a better idea please share.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
12-21-2005 10:42
what attach point are you using?
you see there is no way to detect the rotation of the head, neck, eyes. weighst; so unless you attach the eyes to the pelvis or lock those joints to a constant there is no way. That said, each attach point has a default rotation associated with it, once you take all that into account it should not be an issue.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
12-21-2005 11:23
Attachments can't tell which way they're facing, because they don't exist in the world. Even if you account for the default rotations, any animation will throw it off.
|