Jump to content

primface always faces nearby users camera


anouarr
 Share

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

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

Recommended Posts

 Here's an example for the x-axis facing the owner:

rotation YPR2Rot(vector v) // Yaw Pitch Roll
{   return
        <llSin(v.z/2),0,0,llCos(v.z/2)> *
        <0,llSin(v.y/2),0,llCos(v.y/2)> *
        <0,0,llSin(v.x/2),llCos(v.x/2)> ;
}
rotation uVectorRoll2Rot(vector v,float r)
{   return YPR2Rot(<llAtan2(v.y,v.x),-llAtan2(v.z,llVecMag(<v.x,v.y,0>)),r>);
}
default
{   state_entry()
    {   while(TRUE)
        {   vector target=llList2Vector(
                llGetObjectDetails(llGetOwner(),
                [OBJECT_POS]),0)-llGetPos();
            //Use one or the other and compare:
            rotation rot = // choose 1
                uVectorRoll2Rot(target,0);
                //llAxisAngle2Rot(<0,0,1>,llAtan2(target.y,target.x));
            //we can change the 'forward axis' with a left multiplication:
            //rot = llRotBetween(<0,0,1>/*forward axis*/ , <1,0,0>) * rot;
            llSetRot(rot);
        }
    }
}

I'm a tad too lazy at the moment to fit that into a sensor (in a sensor event, llDetectedKey(0) is usually the closest detected result)

 

Edited by Quistess Alpha
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 487 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...