Jump to content

Avatar Facing


AthenaStarfire
 Share

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

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

Recommended Posts

I can't seem to figure out a simple way to state which way an avatar is facing after a teleport...

The teleport works fine...normal sit/unsit type. Would like to be able to state in the script which way facing when they arrive

0 Deg (N) 90 Deg (E) 180 Deg (S) and 270 deg (W)

Cheers

 

 

 

Link to comment
Share on other sites

If you are scripting for an Experience or if you intend to teleport the owner of the script, you can do that with llTeleportAgent or llTeleportAgentGlobalCoords.  Otherwise, you can't script a facing direction except in the simple case where you are doing a "sit teleport" within the region.  In that simple case, you can set the seat's rotation either in its sit target or as you are about to unseat the avatar.

  • Like 1
Link to comment
Share on other sites

How would I get the avatar to face West (270 degrees) when it unsits

reset()
{
    vector target;
    target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
    llSitTarget(target, ZERO_ROTATION); //teleport
    llSetSitText("Teleport");
}

 

Link to comment
Share on other sites

Change llSetTarget(target,ZERO_ROTATION);  to llSitTarget(target,llEuler2Rot(<0.0,0.0,PI>));   That ought to do it.  That particular way to do an in-region "sit" teleporter is the least efficient way to do it, BTW.  You are limited to targets within 300 m.

Link to comment
Share on other sites

I found a much easy to understand way to do it...

{
    vector target;
    
    target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
    float ang=270*DEG_TO_RAD;
    llSitTarget(target,llEuler2Rot((<0.0,0.0,ang>)));
}

You can just put in the compass degrees :)

Cheers

 

 

Link to comment
Share on other sites

That's the same formula, except that yours contains an error.  ZERO_ROTATION is the same as facing East, which is therefore not 90 degrees, but ZERO, by definition.  Your compass is off by 90 degrees.  West is 180 degrees, not 270, and therefore your statement should be contain llEuler2Rot(<0.0,0.0,PI>) or llEuler2Rot(0.0,0.0,180*DEG_TO_RAD>).  Remember, you are in SL, not RL.  ;)

  • Like 1
Link to comment
Share on other sites

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