diff options
author | Teravus Ovares | 2008-02-12 04:27:20 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-12 04:27:20 +0000 |
commit | 6e01769bcff35be9cace62a0342cf2d275608891 (patch) | |
tree | 124df7910fc0f1d31a13e297ced2dd73ce91a292 | |
parent | default to appending for log files per Mantis 530, and per (diff) | |
download | opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.zip opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.gz opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.bz2 opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.xz |
* A bunch of updates to make things more smooth.
** Sending the actual TimeDilation to the client now instead of the 62455 constant. The client is *supposed* to use that value to sync with the simulator. (actually sending ushort.maxvalue * TimeDilation)
** Disabling prim that inter-penetrate instead of just not attaching a joint
** Reduced prim spin a 'little' bit, but not *enough*
** Tweaked the TimeDilation algorithm to be closer to 1.0 by default and various changes to the sim stats reporter
** Created a .SetValues method to PhysicsVector so we can simply call the setvalues function instead of .x, .y, .z sets.
** Experimented with a .GetBytes Method on PhysicsActor to be able to use the LLVector3.FromBytes() method.
** Upped the Inter-penetration depth to 0.25 instead of .08.
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsVector.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 11 |
10 files changed, 133 insertions, 34 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index cb076b5..41ec783 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -1567,7 +1567,7 @@ namespace OpenSim.Region.ClientStack | |||
1567 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 1567 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
1568 | // TODO: don't create new blocks if recycling an old packet | 1568 | // TODO: don't create new blocks if recycling an old packet |
1569 | objupdate.RegionData.RegionHandle = regionHandle; | 1569 | objupdate.RegionData.RegionHandle = regionHandle; |
1570 | objupdate.RegionData.TimeDilation = 64096; | 1570 | objupdate.RegionData.TimeDilation = ushort.MaxValue; |
1571 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 1571 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
1572 | objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry); | 1572 | objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry); |
1573 | 1573 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 219db63..7831858 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -240,7 +240,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
240 | if (TryGetAvatar(remoteClient.AgentId, out av)) { | 240 | if (TryGetAvatar(remoteClient.AgentId, out av)) { |
241 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 241 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
242 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; | 242 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; |
243 | objupdate.RegionData.TimeDilation = 64096; | 243 | objupdate.RegionData.TimeDilation = ushort.MaxValue; |
244 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; | 244 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; |
245 | // avatar stuff - horrible group copypaste | 245 | // avatar stuff - horrible group copypaste |
246 | 246 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6b4f377..b797cc3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | public InnerScene m_innerScene; | 69 | public InnerScene m_innerScene; |
70 | 70 | ||
71 | private Random Rand = new Random(); | 71 | private Random Rand = new Random(); |
72 | private uint _primCount = 702000; | 72 | private uint _primCount = 720000; |
73 | private readonly Mutex _primAllocateMutex = new Mutex(false); | 73 | private readonly Mutex _primAllocateMutex = new Mutex(false); |
74 | 74 | ||
75 | private int m_timePhase = 24; | 75 | private int m_timePhase = 24; |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
113 | 113 | ||
114 | protected int m_fps = 10; | 114 | protected int m_fps = 10; |
115 | protected int m_frame = 0; | 115 | protected int m_frame = 0; |
116 | protected float m_timespan = 0.1f; | 116 | protected float m_timespan = 0.089f; |
117 | protected DateTime m_lastupdate = DateTime.Now; | 117 | protected DateTime m_lastupdate = DateTime.Now; |
118 | 118 | ||
119 | protected float m_timedilation = 1.0f; | 119 | protected float m_timedilation = 1.0f; |
@@ -750,8 +750,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
750 | finally | 750 | finally |
751 | { | 751 | { |
752 | updateLock.ReleaseMutex(); | 752 | updateLock.ReleaseMutex(); |
753 | // Get actual time dilation | ||
754 | float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds); | ||
753 | 755 | ||
754 | m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; | 756 | // If actual time dilation is greater then one, we're catching up, so subtract |
757 | // the amount that's greater then 1 from the time dilation | ||
758 | if (tmpval > 1.0) | ||
759 | { | ||
760 | tmpval = tmpval - (tmpval - 1.0f); | ||
761 | } | ||
762 | m_timedilation = tmpval; | ||
763 | |||
755 | m_lastupdate = DateTime.Now; | 764 | m_lastupdate = DateTime.Now; |
756 | } | 765 | } |
757 | } | 766 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a745d9c..3b146ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1593,7 +1593,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1593 | part.UpdateMovement(); | 1593 | part.UpdateMovement(); |
1594 | } | 1594 | } |
1595 | } | 1595 | } |
1596 | 1596 | public float GetTimeDilation() | |
1597 | { | ||
1598 | return m_scene.TimeDilation; | ||
1599 | } | ||
1597 | /// <summary> | 1600 | /// <summary> |
1598 | /// Added as a way for the storage provider to reset the scene, | 1601 | /// Added as a way for the storage provider to reset the scene, |
1599 | /// most likely a better way to do this sort of thing but for now... | 1602 | /// most likely a better way to do this sort of thing but for now... |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 180ed51..7900900 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -94,10 +94,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
94 | public byte ObjectSaleType; | 94 | public byte ObjectSaleType; |
95 | public int SalePrice; | 95 | public int SalePrice; |
96 | public uint Category; | 96 | public uint Category; |
97 | |||
97 | 98 | ||
98 | public Int32 CreationDate; | 99 | public Int32 CreationDate; |
99 | public uint ParentID = 0; | 100 | public uint ParentID = 0; |
100 | 101 | ||
102 | private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; | ||
101 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); | 103 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); |
102 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); | 104 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); |
103 | private LLUUID m_sitTargetAvatar = LLUUID.Zero; | 105 | private LLUUID m_sitTargetAvatar = LLUUID.Zero; |
@@ -417,9 +419,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
417 | { | 419 | { |
418 | if (PhysActor.IsPhysical) | 420 | if (PhysActor.IsPhysical) |
419 | { | 421 | { |
420 | m_rotationalvelocity.X = PhysActor.RotationalVelocity.X; | 422 | m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(),0); |
421 | m_rotationalvelocity.Y = PhysActor.RotationalVelocity.Y; | ||
422 | m_rotationalvelocity.Z = PhysActor.RotationalVelocity.Z; | ||
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
@@ -1693,7 +1693,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1693 | 1693 | ||
1694 | 1694 | ||
1695 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | 1695 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; |
1696 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, | 1696 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, m_shape, lPos, clientFlags, m_uuid, |
1697 | OwnerID, | 1697 | OwnerID, |
1698 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation); | 1698 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation); |
1699 | } | 1699 | } |
@@ -1741,12 +1741,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1741 | LLQuaternion mRot = RotationOffset; | 1741 | LLQuaternion mRot = RotationOffset; |
1742 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 1742 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) |
1743 | { | 1743 | { |
1744 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 1744 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot); |
1745 | } | 1745 | } |
1746 | else | 1746 | else |
1747 | { | 1747 | { |
1748 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, | 1748 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot, Velocity, |
1749 | RotationalVelocity); | 1749 | RotationalVelocity); |
1750 | //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
1750 | } | 1751 | } |
1751 | } | 1752 | } |
1752 | 1753 | ||
@@ -1755,13 +1756,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1755 | LLQuaternion mRot = RotationOffset; | 1756 | LLQuaternion mRot = RotationOffset; |
1756 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 1757 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) |
1757 | { | 1758 | { |
1758 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 1759 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot); |
1759 | } | 1760 | } |
1760 | else | 1761 | else |
1761 | { | 1762 | { |
1762 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, | 1763 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot, Velocity, |
1763 | RotationalVelocity); | 1764 | RotationalVelocity); |
1764 | //System.Console.WriteLine("RVel:" + RotationalVelocity); | 1765 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); |
1765 | } | 1766 | } |
1766 | } | 1767 | } |
1767 | 1768 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8155b10..5403fc7 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1289,7 +1289,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1289 | LLVector3 pos = m_pos; | 1289 | LLVector3 pos = m_pos; |
1290 | LLVector3 vel = Velocity; | 1290 | LLVector3 vel = Velocity; |
1291 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); | 1291 | LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); |
1292 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z), | 1292 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), |
1293 | new LLVector3(vel.X, vel.Y, vel.Z), rot); | 1293 | new LLVector3(vel.X, vel.Y, vel.Z), rot); |
1294 | 1294 | ||
1295 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1295 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 3e1fec2..a0539f0 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
181 | // Then we divide the whole amount by the amount of seconds pass in between stats updates. | 181 | // Then we divide the whole amount by the amount of seconds pass in between stats updates. |
182 | 182 | ||
183 | sb[0].StatID = (uint) Stats.TimeDilation; | 183 | sb[0].StatID = (uint) Stats.TimeDilation; |
184 | sb[0].StatValue = ((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 184 | sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
185 | 185 | ||
186 | sb[1].StatID = (uint) Stats.SimFPS; | 186 | sb[1].StatID = (uint) Stats.SimFPS; |
187 | sb[1].StatValue = simfps/statsUpdateFactor; | 187 | sb[1].StatValue = simfps/statsUpdateFactor; |
@@ -280,13 +280,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
280 | 280 | ||
281 | public void AddTimeDilation(float td) | 281 | public void AddTimeDilation(float td) |
282 | { | 282 | { |
283 | float tdsetting = td; | 283 | //float tdsetting = td; |
284 | if (tdsetting > 1.0f) | 284 | //if (tdsetting > 1.0f) |
285 | tdsetting = (tdsetting - (tdsetting - 0.91f)); | 285 | //tdsetting = (tdsetting - (tdsetting - 0.91f)); |
286 | 286 | ||
287 | if (tdsetting < 0) | 287 | //if (tdsetting < 0) |
288 | tdsetting = 0.0f; | 288 | //tdsetting = 0.0f; |
289 | m_timeDilation += tdsetting; | 289 | m_timeDilation = td; |
290 | } | 290 | } |
291 | 291 | ||
292 | public void SetRootAgents(int rootAgents) | 292 | public void SetRootAgents(int rootAgents) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index 1f5d0dc..4b2e756 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs | |||
@@ -46,7 +46,12 @@ namespace OpenSim.Region.Physics.Manager | |||
46 | Y = y; | 46 | Y = y; |
47 | Z = z; | 47 | Z = z; |
48 | } | 48 | } |
49 | 49 | public void setValues(float x, float y, float z) | |
50 | { | ||
51 | X = x; | ||
52 | Y = y; | ||
53 | Z = z; | ||
54 | } | ||
50 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | 55 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); |
51 | 56 | ||
52 | public override string ToString() | 57 | public override string ToString() |
@@ -54,6 +59,56 @@ namespace OpenSim.Region.Physics.Manager | |||
54 | return "<" + X + "," + Y + "," + Z + ">"; | 59 | return "<" + X + "," + Y + "," + Z + ">"; |
55 | } | 60 | } |
56 | 61 | ||
62 | /// <summary> | ||
63 | /// These routines are the easiest way to store XYZ values in an LLVector3 without requiring 3 calls. | ||
64 | /// </summary> | ||
65 | /// <returns></returns> | ||
66 | public byte[] GetBytes() | ||
67 | { | ||
68 | byte[] byteArray = new byte[12]; | ||
69 | |||
70 | Buffer.BlockCopy(BitConverter.GetBytes(X), 0, byteArray, 0, 4); | ||
71 | Buffer.BlockCopy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4); | ||
72 | Buffer.BlockCopy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4); | ||
73 | |||
74 | if (!BitConverter.IsLittleEndian) | ||
75 | { | ||
76 | Array.Reverse(byteArray, 0, 4); | ||
77 | Array.Reverse(byteArray, 4, 4); | ||
78 | Array.Reverse(byteArray, 8, 4); | ||
79 | } | ||
80 | |||
81 | return byteArray; | ||
82 | } | ||
83 | |||
84 | public void FromBytes(byte[] byteArray, int pos) | ||
85 | { | ||
86 | byte[] conversionBuffer = null; | ||
87 | if (!BitConverter.IsLittleEndian) | ||
88 | { | ||
89 | // Big endian architecture | ||
90 | if (conversionBuffer == null) | ||
91 | conversionBuffer = new byte[12]; | ||
92 | |||
93 | Buffer.BlockCopy(byteArray, pos, conversionBuffer, 0, 12); | ||
94 | |||
95 | Array.Reverse(conversionBuffer, 0, 4); | ||
96 | Array.Reverse(conversionBuffer, 4, 4); | ||
97 | Array.Reverse(conversionBuffer, 8, 4); | ||
98 | |||
99 | X = BitConverter.ToSingle(conversionBuffer, 0); | ||
100 | Y = BitConverter.ToSingle(conversionBuffer, 4); | ||
101 | Z = BitConverter.ToSingle(conversionBuffer, 8); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | // Little endian architecture | ||
106 | X = BitConverter.ToSingle(byteArray, pos); | ||
107 | Y = BitConverter.ToSingle(byteArray, pos + 4); | ||
108 | Z = BitConverter.ToSingle(byteArray, pos + 8); | ||
109 | } | ||
110 | } | ||
111 | |||
57 | // Operations | 112 | // Operations |
58 | public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) | 113 | public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) |
59 | { | 114 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 12d7694..819d823 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
53 | private bool m_taintshape = false; | 53 | private bool m_taintshape = false; |
54 | private bool m_taintPhysics = false; | 54 | private bool m_taintPhysics = false; |
55 | public bool m_taintremove = false; | 55 | public bool m_taintremove = false; |
56 | public bool m_taintdisable = false; | ||
56 | 57 | ||
57 | private bool m_taintforce = false; | 58 | private bool m_taintforce = false; |
58 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); | 59 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); |
@@ -451,6 +452,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
451 | 452 | ||
452 | if (m_taintforce) | 453 | if (m_taintforce) |
453 | changeAddForce(timestep); | 454 | changeAddForce(timestep); |
455 | |||
456 | if (m_taintdisable) | ||
457 | changedisable(timestep); | ||
454 | } | 458 | } |
455 | 459 | ||
456 | public void Move(float timestep) | 460 | public void Move(float timestep) |
@@ -494,6 +498,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
494 | 498 | ||
495 | m_taintrot = _orientation; | 499 | m_taintrot = _orientation; |
496 | } | 500 | } |
501 | public void changedisable(float timestep) | ||
502 | { | ||
503 | if (Body != (IntPtr) 0) | ||
504 | d.BodyDisable(Body); | ||
505 | |||
506 | m_taintdisable = false; | ||
507 | } | ||
497 | 508 | ||
498 | public void changePhysicsStatus(float timestap) | 509 | public void changePhysicsStatus(float timestap) |
499 | { | 510 | { |
@@ -862,7 +873,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
862 | 873 | ||
863 | public override PhysicsVector RotationalVelocity | 874 | public override PhysicsVector RotationalVelocity |
864 | { | 875 | { |
865 | get { return m_rotationalVelocity; } | 876 | get { |
877 | if (_zeroFlag) | ||
878 | return PhysicsVector.Zero; | ||
879 | m_lastUpdateSent = false; | ||
880 | |||
881 | if (m_rotationalVelocity.IsIdentical(PhysicsVector.Zero, 0.2f)) | ||
882 | return PhysicsVector.Zero; | ||
883 | |||
884 | return m_rotationalVelocity; | ||
885 | } | ||
866 | set { m_rotationalVelocity = value; } | 886 | set { m_rotationalVelocity = value; } |
867 | } | 887 | } |
868 | 888 | ||
@@ -917,6 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
917 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) | 937 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) |
918 | { | 938 | { |
919 | _zeroFlag = true; | 939 | _zeroFlag = true; |
940 | m_throttleUpdates = false; | ||
920 | } | 941 | } |
921 | else | 942 | else |
922 | { | 943 | { |
@@ -944,9 +965,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
944 | { | 965 | { |
945 | m_throttleUpdates = false; | 966 | m_throttleUpdates = false; |
946 | throttleCounter = 0; | 967 | throttleCounter = 0; |
947 | m_rotationalVelocity.X = 0; | 968 | m_rotationalVelocity = PhysicsVector.Zero; |
948 | m_rotationalVelocity.Y = 0; | ||
949 | m_rotationalVelocity.Z = 0; | ||
950 | base.RequestPhysicsterseUpdate(); | 969 | base.RequestPhysicsterseUpdate(); |
951 | m_lastUpdateSent = true; | 970 | m_lastUpdateSent = true; |
952 | } | 971 | } |
@@ -960,10 +979,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
960 | _velocity.X = vel.X; | 979 | _velocity.X = vel.X; |
961 | _velocity.Y = vel.Y; | 980 | _velocity.Y = vel.Y; |
962 | _velocity.Z = vel.Z; | 981 | _velocity.Z = vel.Z; |
963 | 982 | if (_velocity.IsIdentical(PhysicsVector.Zero, 0.5f)) | |
964 | m_rotationalVelocity.X = rotvel.X; | 983 | { |
965 | m_rotationalVelocity.Y = rotvel.Y; | 984 | m_rotationalVelocity = PhysicsVector.Zero; |
966 | m_rotationalVelocity.Z = rotvel.Z; | 985 | } |
986 | else | ||
987 | { | ||
988 | m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); | ||
989 | } | ||
990 | |||
967 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); | 991 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); |
968 | _orientation.w = ori.W; | 992 | _orientation.w = ori.W; |
969 | _orientation.x = ori.X; | 993 | _orientation.x = ori.X; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index f1d8232..1aa141b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -405,8 +405,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
405 | // If you interpenetrate a prim with another prim | 405 | // If you interpenetrate a prim with another prim |
406 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | 406 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) |
407 | { | 407 | { |
408 | // Don't collide, one or both prim will explode. | 408 | if (contacts[i].depth >= 0.25f) |
409 | contacts[i].depth = 0f; | 409 | { |
410 | // Don't collide, one or both prim will explode. | ||
411 | ((OdePrim)p1).m_taintdisable = true; | ||
412 | AddPhysicsActorTaint(p1); | ||
413 | ((OdePrim)p2).m_taintdisable = true; | ||
414 | AddPhysicsActorTaint(p2); | ||
415 | contacts[i].depth = 0f; | ||
416 | } | ||
410 | } | 417 | } |
411 | if (contacts[i].depth >= 1.00f) | 418 | if (contacts[i].depth >= 1.00f) |
412 | { | 419 | { |