diff options
author | UbitUmarov | 2012-07-15 21:32:10 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-15 21:32:10 +0100 |
commit | 59b6473472f191785ca56721d1a838cd1b6b3ade (patch) | |
tree | 60efe1f353d79bcc100e880f6199d66a1561a289 | |
parent | Merge branch 'avination' into ubitwork (diff) | |
parent | Reinstate older set rotation code for avatars since it works in all cases (diff) | |
download | opensim-SC_OLD-59b6473472f191785ca56721d1a838cd1b6b3ade.zip opensim-SC_OLD-59b6473472f191785ca56721d1a838cd1b6b3ade.tar.gz opensim-SC_OLD-59b6473472f191785ca56721d1a838cd1b6b3ade.tar.bz2 opensim-SC_OLD-59b6473472f191785ca56721d1a838cd1b6b3ade.tar.xz |
Merge branch 'avination' into ubitwork
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 71 |
1 files changed, 26 insertions, 45 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 952d5da..5bade25 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8000,7 +8000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8000 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 8000 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
8001 | 8001 | ||
8002 | int idx = 0; | 8002 | int idx = 0; |
8003 | SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used | ||
8004 | 8003 | ||
8005 | bool positionChanged = false; | 8004 | bool positionChanged = false; |
8006 | Vector3 finalPos = Vector3.Zero; | 8005 | Vector3 finalPos = Vector3.Zero; |
@@ -8015,78 +8014,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8015 | 8014 | ||
8016 | switch (code) | 8015 | switch (code) |
8017 | { | 8016 | { |
8018 | // a avatar is a child | ||
8019 | case (int)ScriptBaseClass.PRIM_POSITION: | 8017 | case (int)ScriptBaseClass.PRIM_POSITION: |
8020 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 8018 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
8021 | { | 8019 | { |
8022 | if (remain < 1) | 8020 | if (remain < 1) |
8023 | return; | 8021 | return; |
8022 | |||
8024 | LSL_Vector v; | 8023 | LSL_Vector v; |
8025 | v = rules.GetVector3Item(idx++); | 8024 | v = rules.GetVector3Item(idx++); |
8026 | 8025 | ||
8027 | if (sitpart == null) | 8026 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); |
8027 | if (part == null) | ||
8028 | break; | 8028 | break; |
8029 | 8029 | ||
8030 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position | 8030 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; |
8031 | 8031 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | |
8032 | if (sitpart != sitpart.ParentGroup.RootPart) | 8032 | if (llGetLinkNumber() > 1) |
8033 | { | 8033 | { |
8034 | pos -= sitpart.OffsetPosition; // remove sit part offset | 8034 | localRot = llGetLocalRot(); |
8035 | Quaternion rot = sitpart.RotationOffset; | 8035 | localPos = llGetLocalPos(); |
8036 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | ||
8037 | } | 8036 | } |
8038 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
8039 | pos += sitOffset; | ||
8040 | 8037 | ||
8041 | finalPos = pos; | 8038 | v -= localPos; |
8042 | positionChanged = true; | 8039 | v /= localRot; |
8043 | } | ||
8044 | break; | ||
8045 | 8040 | ||
8046 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8041 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); |
8047 | { | ||
8048 | if (remain < 1) | ||
8049 | return; | ||
8050 | 8042 | ||
8051 | if (sitpart == null) | 8043 | v = v + 2 * sitOffset; |
8052 | break; | ||
8053 | 8044 | ||
8054 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | 8045 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); |
8055 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation | 8046 | av.SendAvatarDataToAllAgents(); |
8056 | 8047 | ||
8057 | // need to replicate SL bug | ||
8058 | SceneObjectGroup sitgrp = sitpart.ParentGroup; | ||
8059 | if (sitgrp != null && sitgrp.RootPart != sitpart) | ||
8060 | { | ||
8061 | rot = sitgrp.RootPart.RotationOffset * rot; | ||
8062 | } | ||
8063 | |||
8064 | Quaternion srot = sitpart.RotationOffset; | ||
8065 | rot = srot * rot; // removed sit part offset rotation | ||
8066 | av.Rotation = rot; | ||
8067 | // av.SendAvatarDataToAllAgents(); | ||
8068 | av.SendTerseUpdateToAllClients(); | ||
8069 | } | 8048 | } |
8070 | break; | 8049 | break; |
8071 | 8050 | ||
8072 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8051 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8052 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
8073 | { | 8053 | { |
8074 | if (remain < 1) | 8054 | if (remain < 1) |
8075 | return; | 8055 | return; |
8076 | 8056 | ||
8077 | if (sitpart == null) | 8057 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; |
8078 | break; | 8058 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; |
8079 | 8059 | ||
8080 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | 8060 | if (llGetLinkNumber() > 1) |
8081 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation | ||
8082 | if (sitpart != sitpart.ParentGroup.RootPart) | ||
8083 | { | 8061 | { |
8084 | Quaternion srot = sitpart.RotationOffset; | 8062 | localRot = llGetLocalRot(); |
8085 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | 8063 | localPos = llGetLocalPos(); |
8086 | } | 8064 | } |
8087 | av.Rotation = rot; | 8065 | |
8088 | // av.SendAvatarDataToAllAgents(); | 8066 | LSL_Rotation r; |
8089 | av.SendTerseUpdateToAllClients(); | 8067 | r = rules.GetQuaternionItem(idx++); |
8068 | r = r * llGetRootRotation() / localRot; | ||
8069 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); | ||
8070 | av.SendAvatarDataToAllAgents(); | ||
8090 | } | 8071 | } |
8091 | break; | 8072 | break; |
8092 | 8073 | ||