aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c14d454..a73977e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2506,8 +2506,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2506 2506
2507 public void llLookAt(LSL_Vector target, double strength, double damping) 2507 public void llLookAt(LSL_Vector target, double strength, double damping)
2508 { 2508 {
2509 // partial implementation, rotates objects correctly but does not apply strength or damping attributes
2510
2509 m_host.AddScriptLPS(1); 2511 m_host.AddScriptLPS(1);
2510 NotImplemented("llLookAt"); 2512 // Determine where we are looking from
2513 LSL_Vector from = llGetPos();
2514
2515 // Work out the normalised vector from the source to the target
2516 LSL_Vector delta = llVecNorm(target - from);
2517 LSL_Vector angle = new LSL_Vector(0,0,0);
2518
2519 // Calculate the yaw
2520 // subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system
2521 angle.x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO;
2522
2523 // Calculate pitch
2524 angle.y = llAtan2(delta.x, llSqrt((delta.y * delta.y) + (delta.z * delta.z)));
2525
2526 // we need to convert from a vector describing
2527 // the angles of rotation in radians into rotation value
2528
2529 LSL_Types.Quaternion rot = llEuler2Rot(angle);
2530
2531 // Orient the object to the angle calculated
2532 llSetRot(rot);
2511 } 2533 }
2512 2534
2513 public void llStopLookAt() 2535 public void llStopLookAt()