# primface always faces nearby users camera

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

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

## Recommended Posts

I had a script  that  made an assigned prim-face always faces  a nearby user's camera. Lost it. can anybody help me ?

Edited by anouarr
• 1
##### Share on other sites

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
• 2
##### Share on other sites

thanx  so much    works perfect       roses on your path......

##### Share on other sites

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

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