diff options
Diffstat (limited to 'OpenSim')
5 files changed, 37 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 24cdc7a..a0d7bfd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -853,7 +853,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | 853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); |
854 | } | 854 | } |
855 | */ | 855 | */ |
856 | public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop) | 856 | |
857 | // copy from LSL_constants.cs | ||
858 | const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination | ||
859 | const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails | ||
860 | const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation | ||
861 | |||
862 | public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) | ||
857 | { | 863 | { |
858 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) | 864 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) |
859 | return; | 865 | return; |
@@ -900,38 +906,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
900 | } | 906 | } |
901 | } | 907 | } |
902 | 908 | ||
909 | bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0; | ||
910 | bool setrot = (flags & OSTPOBJ_SETROT) != 0; | ||
911 | |||
903 | rotation.Normalize(); | 912 | rotation.Normalize(); |
913 | bool dorot = (Math.Abs(rotation.W) < 0.999); | ||
914 | |||
915 | Quaternion currentRot = RootPart.RotationOffset; | ||
916 | if(dorot && setrot) | ||
917 | rotation = rotation * Quaternion.Conjugate(currentRot); | ||
918 | |||
904 | if(stop) | 919 | if(stop) |
905 | { | 920 | { |
906 | RootPart.Stop(); | 921 | RootPart.Stop(); |
907 | if(Math.Abs(rotation.W) < 0.999) | ||
908 | { | ||
909 | Quaternion rot = RootPart.RotationOffset; | ||
910 | rot *= rotation; | ||
911 | RootPart.RotationOffset = rot; | ||
912 | } | ||
913 | } | 922 | } |
914 | else | 923 | else |
915 | { | 924 | { |
916 | if(Math.Abs(rotation.W) < 0.999) | 925 | if(dorot) |
917 | { | 926 | { |
918 | Quaternion rot = RootPart.RotationOffset; | ||
919 | Vector3 vel = RootPart.Velocity; | 927 | Vector3 vel = RootPart.Velocity; |
920 | Vector3 avel = RootPart.AngularVelocity; | 928 | Vector3 avel = RootPart.AngularVelocity; |
921 | Vector3 acc = RootPart.Acceleration; | 929 | Vector3 acc = RootPart.Acceleration; |
922 | 930 | ||
923 | rot *= rotation; | ||
924 | vel *= rotation; | 931 | vel *= rotation; |
925 | avel *= rotation; | 932 | avel *= rotation; |
926 | acc *= rotation; | 933 | acc *= rotation; |
927 | 934 | ||
928 | RootPart.RotationOffset = rot; | ||
929 | RootPart.Velocity = vel; | 935 | RootPart.Velocity = vel; |
930 | RootPart.AngularVelocity = avel; | 936 | RootPart.AngularVelocity = avel; |
931 | RootPart.Acceleration = acc; | 937 | RootPart.Acceleration = acc; |
932 | } | 938 | } |
933 | } | 939 | } |
934 | 940 | ||
941 | if(dorot) | ||
942 | { | ||
943 | currentRot *= rotation; | ||
944 | RootPart.RotationOffset = currentRot; | ||
945 | } | ||
946 | |||
935 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; | 947 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; |
936 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; | 948 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; |
937 | if(targetPosition.Z < h) | 949 | if(targetPosition.Z < h) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ddf5078..b50ae28 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -4632,17 +4632,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4632 | /// <param name="objectUUID">the id of the linkset to teleport</param> | 4632 | /// <param name="objectUUID">the id of the linkset to teleport</param> |
4633 | /// <param name="targetPos">target position</param> | 4633 | /// <param name="targetPos">target position</param> |
4634 | /// <param name="rotation"> a rotation to apply</param> | 4634 | /// <param name="rotation"> a rotation to apply</param> |
4635 | /// <param name="stop">if TRUE (!=0) stop at destination</param> | 4635 | /// <param name="flags">several flags/param> |
4636 | /// <remarks> | 4636 | /// <remarks> |
4637 | /// only does teleport local to region | 4637 | /// only does teleport local to region |
4638 | /// object owner must have rights to run scripts on target location | 4638 | /// if object has scripts, owner must have rights to run scripts on target location |
4639 | /// object owner must have rights to enter ojects on target location | 4639 | /// object owner must have rights to enter ojects on target location |
4640 | /// target location parcel must have enought free prims capacity for the linkset prims | 4640 | /// target location parcel must have enought free prims capacity for the linkset prims |
4641 | /// all avatars siting on the object must have access to target location | 4641 | /// all avatars siting on the object must have access to target location |
4642 | /// has a cool down time. retries before expire reset it | 4642 | /// has a cool down time. retries before expire reset it |
4643 | /// fail conditions are silent ignored | 4643 | /// fail conditions are silent ignored |
4644 | /// </remarks> | 4644 | /// </remarks> |
4645 | public void osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop) | 4645 | public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags) |
4646 | { | 4646 | { |
4647 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); | 4647 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
4648 | m_host.AddScriptLPS(1); | 4648 | m_host.AddScriptLPS(1); |
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4660 | 4660 | ||
4661 | UUID myid = m_host.ParentGroup.UUID; | 4661 | UUID myid = m_host.ParentGroup.UUID; |
4662 | 4662 | ||
4663 | sog.ObjectTeleport(myid, targetPos, rotation, stop != 0); | 4663 | sog.TeleportObject(myid, targetPos, rotation, flags); |
4664 | // a delay here may break vehicles | 4664 | // a delay here may break vehicles |
4665 | } | 4665 | } |
4666 | } | 4666 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 4722fed..879fe51 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -496,6 +496,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
496 | void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass); | 496 | void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass); |
497 | void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot); | 497 | void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot); |
498 | 498 | ||
499 | void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop); | 499 | void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags); |
500 | } | 500 | } |
501 | } | 501 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 3a90c77..59493a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -853,5 +853,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
853 | /// process message parameter as regex | 853 | /// process message parameter as regex |
854 | /// </summary> | 854 | /// </summary> |
855 | public const int OS_LISTEN_REGEX_MESSAGE = 0x2; | 855 | public const int OS_LISTEN_REGEX_MESSAGE = 0x2; |
856 | |||
857 | // for osTeleportObject | ||
858 | public const int OSTPOBJ_NONE = 0x0; | ||
859 | public const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination | ||
860 | public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails | ||
861 | public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation | ||
862 | |||
856 | } | 863 | } |
857 | } | 864 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 37e7a17..3c8e02d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1140,9 +1140,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1140 | m_OSSL_Functions.osClearInertia(); | 1140 | m_OSSL_Functions.osClearInertia(); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | public void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop) | 1143 | public void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags) |
1144 | { | 1144 | { |
1145 | m_OSSL_Functions.osObjectTeleport(objectUUID, targetPos, targetrotation, stop); | 1145 | m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | } | 1148 | } |