diff options
author | UbitUmarov | 2012-06-13 04:59:09 +0100 |
---|---|---|
committer | UbitUmarov | 2012-06-13 04:59:09 +0100 |
commit | 7bd274b3d34b5f7cbdc4e4d9e9f6915392b004b8 (patch) | |
tree | 5db7156946ad39681d51178400c263cad007edb9 | |
parent | convert a LSL rotation of <0,0,0,0> to <0,0,0,1> and not <0,0,1,0> in SitTar... (diff) | |
download | opensim-SC-7bd274b3d34b5f7cbdc4e4d9e9f6915392b004b8.zip opensim-SC-7bd274b3d34b5f7cbdc4e4d9e9f6915392b004b8.tar.gz opensim-SC-7bd274b3d34b5f7cbdc4e4d9e9f6915392b004b8.tar.bz2 opensim-SC-7bd274b3d34b5f7cbdc4e4d9e9f6915392b004b8.tar.xz |
Changed t adding the avatar dependent sit offset and not subtracting, so not to break inworld contents. SL ported scripts will show a sit error around 0.1m. Added respective compensation in LSL api to maintain coerence. Fixed several bugs still on SET/GET[link]PrimitiveParams[fast] and llGetObjectDetails()
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 67 |
2 files changed, 46 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 059d4c2..87b4d9f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2383,8 +2383,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2383 | 2383 | ||
2384 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | 2384 | Vector3 up = new Vector3((float)x, (float)y, (float)z); |
2385 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; | 2385 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; |
2386 | // m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; | 2386 | |
2387 | m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; | 2387 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; |
2388 | |||
2389 | // m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; | ||
2388 | Rotation = sitTargetOrient; | 2390 | Rotation = sitTargetOrient; |
2389 | ParentPosition = part.AbsolutePosition; | 2391 | ParentPosition = part.AbsolutePosition; |
2390 | part.ParentGroup.AddAvatar(UUID); | 2392 | part.ParentGroup.AddAvatar(UUID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 089b401..fafeba2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7959,13 +7959,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7959 | 7959 | ||
7960 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position | 7960 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position |
7961 | 7961 | ||
7962 | pos -= sitpart.OffsetPosition; // remove sit part offset | 7962 | if (sitpart != sitpart.ParentGroup.RootPart) |
7963 | 7963 | { | |
7964 | Quaternion rot = sitpart.RotationOffset; | 7964 | pos -= sitpart.OffsetPosition; // remove sit part offset |
7965 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | 7965 | Quaternion rot = sitpart.RotationOffset; |
7966 | 7966 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | |
7967 | // Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f); | 7967 | } |
7968 | // pos += sitOffset; | 7968 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); |
7969 | pos += sitOffset; | ||
7969 | 7970 | ||
7970 | finalPos = pos; | 7971 | finalPos = pos; |
7971 | positionChanged = true; | 7972 | positionChanged = true; |
@@ -7990,8 +7991,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7990 | rot = sitgrp.RootPart.RotationOffset * rot; | 7991 | rot = sitgrp.RootPart.RotationOffset * rot; |
7991 | } | 7992 | } |
7992 | 7993 | ||
7993 | Quaternion srot = sitpart.GetWorldRotation(); | 7994 | Quaternion srot = sitpart.RotationOffset; |
7994 | rot = Quaternion.Conjugate(srot) * rot; // removed sit part world rotation | 7995 | rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation |
7995 | av.Rotation = rot; | 7996 | av.Rotation = rot; |
7996 | av.SendAvatarDataToAllAgents(); | 7997 | av.SendAvatarDataToAllAgents(); |
7997 | } | 7998 | } |
@@ -8007,10 +8008,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8007 | 8008 | ||
8008 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | 8009 | LSL_Rotation r = rules.GetQuaternionItem(idx++); |
8009 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation | 8010 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation |
8010 | 8011 | if (sitpart != sitpart.ParentGroup.RootPart) | |
8011 | Quaternion srot = sitpart.RotationOffset; | 8012 | { |
8012 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | 8013 | Quaternion srot = sitpart.RotationOffset; |
8013 | 8014 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | |
8015 | } | ||
8014 | av.Rotation = rot; | 8016 | av.Rotation = rot; |
8015 | av.SendAvatarDataToAllAgents(); | 8017 | av.SendAvatarDataToAllAgents(); |
8016 | } | 8018 | } |
@@ -8956,12 +8958,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8956 | 8958 | ||
8957 | case (int)ScriptBaseClass.PRIM_POSITION: | 8959 | case (int)ScriptBaseClass.PRIM_POSITION: |
8958 | 8960 | ||
8959 | // can't use Abs pos to extract offset... | ||
8960 | // Vector3 pos = avatar.AbsolutePosition; | ||
8961 | Vector3 pos = avatar.OffsetPosition; | 8961 | Vector3 pos = avatar.OffsetPosition; |
8962 | 8962 | ||
8963 | // Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); | 8963 | Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); |
8964 | // pos -= sitOffset; | 8964 | pos -= sitOffset; |
8965 | 8965 | ||
8966 | if( sitPart != null) | 8966 | if( sitPart != null) |
8967 | pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); | 8967 | pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); |
@@ -9151,7 +9151,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9151 | 9151 | ||
9152 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9152 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
9153 | Quaternion lrot = avatar.Rotation; | 9153 | Quaternion lrot = avatar.Rotation; |
9154 | if (sitPart != null) | 9154 | |
9155 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) | ||
9155 | { | 9156 | { |
9156 | lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset | 9157 | lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset |
9157 | } | 9158 | } |
@@ -9160,10 +9161,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9160 | 9161 | ||
9161 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9162 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
9162 | Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part | 9163 | Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part |
9163 | // Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); | 9164 | Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); |
9164 | // lpos -= lsitOffset; | 9165 | lpos -= lsitOffset; |
9165 | 9166 | ||
9166 | if (sitPart != null) | 9167 | if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) |
9167 | { | 9168 | { |
9168 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim | 9169 | lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim |
9169 | } | 9170 | } |
@@ -11819,12 +11820,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11819 | ret.Add(new LSL_String("")); | 11820 | ret.Add(new LSL_String("")); |
11820 | break; | 11821 | break; |
11821 | case ScriptBaseClass.OBJECT_POS: | 11822 | case ScriptBaseClass.OBJECT_POS: |
11822 | Vector3 avpos = av.AbsolutePosition; | 11823 | Vector3 avpos; |
11824 | |||
11825 | if (av.ParentID != 0 && av.ParentPart != null) | ||
11826 | { | ||
11827 | avpos = av.OffsetPosition; | ||
11828 | |||
11829 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f); | ||
11830 | avpos -= sitOffset; | ||
11831 | |||
11832 | avpos = av.ParentPart.GetWorldPosition() + avpos * av.ParentPart.GetWorldRotation(); | ||
11833 | } | ||
11834 | else | ||
11835 | avpos = av.AbsolutePosition; | ||
11836 | |||
11823 | ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); | 11837 | ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); |
11824 | break; | 11838 | break; |
11825 | case ScriptBaseClass.OBJECT_ROT: | 11839 | case ScriptBaseClass.OBJECT_ROT: |
11826 | Quaternion avrot = av.Rotation; | 11840 | Quaternion avrot = av.Rotation; |
11827 | if(av.ParentID != 0 && av.ParentPart != null) | 11841 | if (av.ParentID != 0 && av.ParentPart != null) |
11828 | { | 11842 | { |
11829 | avrot = av.ParentPart.GetWorldRotation() * avrot; | 11843 | avrot = av.ParentPart.GetWorldRotation() * avrot; |
11830 | } | 11844 | } |
@@ -11896,8 +11910,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11896 | ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); | 11910 | ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); |
11897 | break; | 11911 | break; |
11898 | case ScriptBaseClass.OBJECT_ROT: | 11912 | case ScriptBaseClass.OBJECT_ROT: |
11899 | Quaternion orot = obj.RotationOffset; | 11913 | // Quaternion orot = obj.RotationOffset; |
11900 | ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W)); | 11914 | // ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W)); |
11915 | |||
11916 | LSL_Rotation objrot = GetPartRot(obj); | ||
11917 | ret.Add(objrot); | ||
11901 | break; | 11918 | break; |
11902 | case ScriptBaseClass.OBJECT_VELOCITY: | 11919 | case ScriptBaseClass.OBJECT_VELOCITY: |
11903 | Vector3 ovel = obj.Velocity; | 11920 | Vector3 ovel = obj.Velocity; |