aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorubit2012-07-17 01:33:31 +0200
committerubit2012-07-17 01:33:31 +0200
commit05cca8c694635ce19b3dd083462960dece6c4ea5 (patch)
tree9a779be0feeea7f591c099cde5e2ed61416e1699
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentUbitOde: remove useless water collider from active code. (diff)
downloadopensim-SC-05cca8c694635ce19b3dd083462960dece6c4ea5.zip
opensim-SC-05cca8c694635ce19b3dd083462960dece6c4ea5.tar.gz
opensim-SC-05cca8c694635ce19b3dd083462960dece6c4ea5.tar.bz2
opensim-SC-05cca8c694635ce19b3dd083462960dece6c4ea5.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs85
2 files changed, 43 insertions, 58 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 139c4e8..a554897 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -203,9 +203,9 @@ namespace OpenSim.Region.Physics.OdePlugin
203 private float waterlevel = 0f; 203 private float waterlevel = 0f;
204 private int framecount = 0; 204 private int framecount = 0;
205 205
206 private IntPtr WaterGeom = IntPtr.Zero; 206// private IntPtr WaterGeom = IntPtr.Zero;
207 private IntPtr WaterHeightmapData = IntPtr.Zero; 207// private IntPtr WaterHeightmapData = IntPtr.Zero;
208 private GCHandle WaterMapHandler = new GCHandle(); 208// private GCHandle WaterMapHandler = new GCHandle();
209 209
210 public float avPIDD = 2200f; // make it visible 210 public float avPIDD = 2200f; // make it visible
211 public float avPIDP = 900f; // make it visible 211 public float avPIDP = 900f; // make it visible
@@ -2491,9 +2491,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2491 public override void SetWaterLevel(float baseheight) 2491 public override void SetWaterLevel(float baseheight)
2492 { 2492 {
2493 waterlevel = baseheight; 2493 waterlevel = baseheight;
2494 randomizeWater(waterlevel); 2494// randomizeWater(waterlevel);
2495 } 2495 }
2496 2496/*
2497 public void randomizeWater(float baseheight) 2497 public void randomizeWater(float baseheight)
2498 { 2498 {
2499 const uint heightmapWidth = Constants.RegionSize + 2; 2499 const uint heightmapWidth = Constants.RegionSize + 2;
@@ -2574,7 +2574,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2574 } 2574 }
2575 } 2575 }
2576 } 2576 }
2577 2577*/
2578 public override void Dispose() 2578 public override void Dispose()
2579 { 2579 {
2580 lock (OdeLock) 2580 lock (OdeLock)
@@ -2624,7 +2624,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2624 2624
2625 TerrainHeightFieldHeightsHandlers.Clear(); 2625 TerrainHeightFieldHeightsHandlers.Clear();
2626 TerrainHeightFieldHeights.Clear(); 2626 TerrainHeightFieldHeights.Clear();
2627 2627/*
2628 if (WaterGeom != IntPtr.Zero) 2628 if (WaterGeom != IntPtr.Zero)
2629 { 2629 {
2630 d.GeomDestroy(WaterGeom); 2630 d.GeomDestroy(WaterGeom);
@@ -2636,7 +2636,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2636 if (WaterMapHandler.IsAllocated) 2636 if (WaterMapHandler.IsAllocated)
2637 WaterMapHandler.Free(); 2637 WaterMapHandler.Free();
2638 } 2638 }
2639 2639*/
2640 if (ContactgeomsArray != IntPtr.Zero) 2640 if (ContactgeomsArray != IntPtr.Zero)
2641 Marshal.FreeHGlobal(ContactgeomsArray); 2641 Marshal.FreeHGlobal(ContactgeomsArray);
2642 if (GlobalContactsArray != IntPtr.Zero) 2642 if (GlobalContactsArray != IntPtr.Zero)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5cbcfec..595dd8a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2470,8 +2470,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2470 2470
2471 public LSL_Rotation llGetLocalRot() 2471 public LSL_Rotation llGetLocalRot()
2472 { 2472 {
2473 return GetPartLocalRot(m_host);
2474 }
2475
2476 private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
2477 {
2473 m_host.AddScriptLPS(1); 2478 m_host.AddScriptLPS(1);
2474 Quaternion rot = m_host.RotationOffset; 2479 Quaternion rot = part.RotationOffset;
2475 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); 2480 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2476 } 2481 }
2477 2482
@@ -8000,7 +8005,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. 8005 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
8001 8006
8002 int idx = 0; 8007 int idx = 0;
8003 SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
8004 8008
8005 bool positionChanged = false; 8009 bool positionChanged = false;
8006 Vector3 finalPos = Vector3.Zero; 8010 Vector3 finalPos = Vector3.Zero;
@@ -8015,81 +8019,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8015 8019
8016 switch (code) 8020 switch (code)
8017 { 8021 {
8018 // a avatar is a child
8019 case (int)ScriptBaseClass.PRIM_POSITION: 8022 case (int)ScriptBaseClass.PRIM_POSITION:
8020 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8023 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8021 { 8024 {
8022 if (remain < 1) 8025 if (remain < 1)
8023 return; 8026 return;
8027
8024 LSL_Vector v; 8028 LSL_Vector v;
8025 v = rules.GetVector3Item(idx++); 8029 v = rules.GetVector3Item(idx++);
8026 8030
8027 if (sitpart == null) 8031 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8032 if (part == null)
8028 break; 8033 break;
8029 8034
8030 Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position 8035 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8031 8036 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8032 if (sitpart != sitpart.ParentGroup.RootPart) 8037 if (part.LinkNum > 1)
8033 { 8038 {
8034 pos -= sitpart.OffsetPosition; // remove sit part offset 8039 localRot = GetPartLocalRot(part);
8035 Quaternion rot = sitpart.RotationOffset; 8040 localPos = GetPartLocalPos(part);
8036 pos *= Quaternion.Conjugate(rot); // removed sit part rotation
8037 } 8041 }
8038 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
8039 pos += sitOffset;
8040 8042
8041 finalPos = pos; 8043 v -= localPos;
8042 positionChanged = true; 8044 v /= localRot;
8043 }
8044 break;
8045 8045
8046 case (int)ScriptBaseClass.PRIM_ROTATION: 8046 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 8047
8051 if (sitpart == null) 8048 v = v + 2 * sitOffset;
8052 break;
8053 8049
8054 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8050 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 8051 av.SendAvatarDataToAllAgents();
8056
8057 SceneObjectGroup sitgrp = sitpart.ParentGroup;
8058 if (sitgrp != null)
8059 {
8060 // need to replicate SL bug
8061 rot = sitgrp.RootPart.RotationOffset * rot;
8062 if (sitgrp.RootPart != sitpart)
8063 {
8064 Quaternion srot = sitpart.RotationOffset;
8065 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
8066 }
8067 8052
8068 av.Rotation = rot;
8069 // av.SendAvatarDataToAllAgents();
8070 av.SendTerseUpdateToAllClients();
8071 }
8072 } 8053 }
8073 break; 8054 break;
8074 8055
8075 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8056 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8057 case (int)ScriptBaseClass.PRIM_ROTATION:
8076 { 8058 {
8077 if (remain < 1) 8059 if (remain < 1)
8078 return; 8060 return;
8079 8061
8080 if (sitpart == null) 8062 LSL_Rotation r;
8063 r = rules.GetQuaternionItem(idx++);
8064
8065 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8066 if (part == null)
8081 break; 8067 break;
8082 8068
8083 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8069 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8084 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation 8070 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8085 if (sitpart != sitpart.ParentGroup.RootPart) 8071
8086 { 8072 if (part.LinkNum > 1)
8087 Quaternion srot = sitpart.RotationOffset; 8073 localRot = GetPartLocalRot(part);
8088 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation 8074
8089 } 8075 r = r * llGetRootRotation() / localRot;
8090 av.Rotation = rot; 8076 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
8091// av.SendAvatarDataToAllAgents(); 8077 av.SendAvatarDataToAllAgents();
8092 av.SendTerseUpdateToAllClients();
8093 } 8078 }
8094 break; 8079 break;
8095 8080