AthenaStarfire 0 Posted May 25, 2017 Share Posted May 25, 2017 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 post Share on other sites
Rolig Loon 26,951 Posted May 25, 2017 Share Posted May 25, 2017 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. 1 Link to post Share on other sites
AthenaStarfire 0 Posted May 26, 2017 Author Share Posted May 26, 2017 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 post Share on other sites
Rolig Loon 26,951 Posted May 26, 2017 Share Posted May 26, 2017 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 post Share on other sites
AthenaStarfire 0 Posted May 26, 2017 Author Share Posted May 26, 2017 Thanks this is pretty much only an 'elevator' in a structure in a 1024sq lot... with 27m floors Link to post Share on other sites
Rolig Loon 26,951 Posted May 26, 2017 Share Posted May 26, 2017 Cool. Good luck with it. Link to post Share on other sites
AthenaStarfire 0 Posted May 26, 2017 Author Share Posted May 26, 2017 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 post Share on other sites
Rolig Loon 26,951 Posted May 26, 2017 Share Posted May 26, 2017 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. 1 Link to post Share on other sites
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now