diff options
author | Kitto Flora | 2011-01-13 04:44:04 +0000 |
---|---|---|
committer | Kitto Flora | 2011-01-13 04:44:04 +0000 |
commit | d92069fb8b0a4f1ca51a24599ae308458c424e19 (patch) | |
tree | c13868793bd39a1742f5133c3970a860d34d8f81 /OpenSim | |
parent | Remove old guids from the examples, for completeness' sake (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 24 |
2 files changed, 22 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b8ad3ca..927f78d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1866,7 +1866,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1866 | Quaternion partIRot = Quaternion.Inverse(partRot); | 1866 | Quaternion partIRot = Quaternion.Inverse(partRot); |
1867 | 1867 | ||
1868 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av | 1868 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av |
1869 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av | 1869 | Vector3 avStandUp = new Vector3(0.3f, 0f, 0f) * avatarRot; // 0.3M infront of av |
1870 | 1870 | ||
1871 | 1871 | ||
1872 | if (m_physicsActor == null) | 1872 | if (m_physicsActor == null) |
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 | ||