aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorKitto Flora2011-01-13 04:44:04 +0000
committerKitto Flora2011-01-13 04:44:04 +0000
commitd92069fb8b0a4f1ca51a24599ae308458c424e19 (patch)
treec13868793bd39a1742f5133c3970a860d34d8f81 /OpenSim/Region/ScriptEngine
parentRemove old guids from the examples, for completeness' sake (diff)
downloadopensim-SC_OLD-d92069fb8b0a4f1ca51a24599ae308458c424e19.zip
opensim-SC_OLD-d92069fb8b0a4f1ca51a24599ae308458c424e19.tar.gz
opensim-SC_OLD-d92069fb8b0a4f1ca51a24599ae308458c424e19.tar.bz2
opensim-SC_OLD-d92069fb8b0a4f1ca51a24599ae308458c424e19.tar.xz
Add llLookAt() kinetic. Reduce StandUp +x offset to 0.3M.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 47492ea..805b344 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3023,9 +3023,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3023 LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d)); 3023 LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d));
3024 llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos())); 3024 llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos()));
3025 */ 3025 */
3026 // Send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt. 3026 if (m_host.PhysActor != null && !m_host.PhysActor.IsPhysical)
3027 Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f); 3027 {
3028 m_host.RotLookAt(q, (float)strength, (float)damping); 3028 // Part is non-phys, convert this to a llSetRot()
3029 Vector3 tgt = new Vector3((float)target.x, (float)target.y, (float)target.z);
3030 Vector3 dir = tgt - m_host.GroupPosition;
3031 dir.Normalize();
3032 float tzrot = (float)Math.Atan2(dir.Y, dir.X);
3033 float txy = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
3034 float terot = (float)Math.Atan2(-dir.Z, txy);
3035 LSL_Vector az = new LSL_Vector(0.0f, 0.0f, tzrot);
3036 LSL_Vector ae = new LSL_Vector(0.0f, terot, 0.0f);
3037 LSL_Types.Quaternion spin = llEuler2Rot(az);
3038 LSL_Types.Quaternion rot = llEuler2Rot(ae) * spin;
3039 llSetRot(rot);
3040 }
3041 else
3042 {
3043 // Physical, send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt.
3044 Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f);
3045 m_host.RotLookAt(q, (float)strength, (float)damping);
3046 }
3029 3047
3030 } 3048 }
3031 3049