Jump to content

None of the llRotLookAt example codes actually work!


SkunkHunt
 Share

You are about to reply to a thread that has been inactive for 3130 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I want to know why every single example of llRotLookAt and llLookAt do not work.

I very simply have an eye, a sphere prim with an eye texture.  When I use any of the examples in the LSL wiki or elsewhere what i get is the eye looks everywhere except where the detected agent is unless you are standing directly in front of the eye, then it appears to be looking at you but in reality it isn't.

As soon as you move to one side or the other, the eye rotates to the opposite side.

This is how all of the rotate scripts function ...not one of them actually look at the target.

This is a very frustrating reality for me and makes me wonder how could the code be on the site (apparently for years) and nobody address this distressing fact about it?

Seriously, not one of the example rotate scripts operate like they say they will.  The eye looks everywhere but the agent detected.

Link to comment
Share on other sites

That's odd.  They have always worked before.  For example, the sample in llRotLookAt is a single line, not a complete script, but it works if you incorporate it into a full script, like this...

default{    state_entry()    {        llSetStatus(STATUS_PHYSICS,TRUE);  // Make the object physical    }    touch_start(integer num)    {        vector vPosTarget = llDetectedPos(0);   // Where it the person who touched me?        llRotLookAt( llRotBetween(<0.0,1.0,0.0>,llVecNorm( vPosTarget - llGetPos() ) ),1.0,0.4);  // Point my local +Y axis toward vPosTarget    }}

The scripted object should point its local  +Y axis at you when you touch it.  If you want it to update continuously, you'll have to make a timer do some work....

integer gON;key gAv;default{    state_entry()    {        llSetStatus(STATUS_PHYSICS,TRUE);  // Make the object physical        llSetBuoyancy(1.0);    }    touch_start(integer num)    {        llSetTimerEvent(0.2 *( gON = !gON));        gAv = llDetectedKey(0);    }    timer()    {        vector vPosTarget = llList2Vector(llGetObjectDetails(gAv,[OBJECT_POS]),0);   // Where it the person who touched me?        llRotLookAt( llRotBetween(<0.0,1.0,0.0>,llVecNorm( vPosTarget - llGetPos() ) ),1.0,0.4);  // Point my local +Y axis toward vPosTarget    }}

The timer will keep looking at you until you click it a second time.

Double check to be sure that you know which direction the +Y axis of your sphere is oriented.

 EDIT to add the second example.  BTW, recall that llDetectedPos for an avatar is the position of the avatar's body center.  That's unfortunately about the center of your groin.  If you want to have the eyeball look at the person's face, you'll have to aim about 0.6 m higher, so vPosTarget + <0.0,0.0,0.6> .

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3130 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...