diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 23 |
3 files changed, 47 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index bd81d50..1fff846 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1105,7 +1105,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1105 | public void UpdatePositionAndVelocity() | 1105 | public void UpdatePositionAndVelocity() |
1106 | { | 1106 | { |
1107 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1107 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1108 | d.Vector3 vec = d.BodyGetPosition(Body); | 1108 | d.Vector3 vec; |
1109 | try | ||
1110 | { | ||
1111 | vec = d.BodyGetPosition(Body); | ||
1112 | } | ||
1113 | catch (NullReferenceException) | ||
1114 | { | ||
1115 | _parent_scene.BadCharacter(this); | ||
1116 | vec = new d.Vector3(_position.X, _position.Y, _position.Z); | ||
1117 | base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! | ||
1118 | m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name); | ||
1119 | } | ||
1120 | |||
1109 | 1121 | ||
1110 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1122 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1111 | if (vec.X < 0.0f) vec.X = 0.0f; | 1123 | if (vec.X < 0.0f) vec.X = 0.0f; |
@@ -1137,7 +1149,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1137 | else | 1149 | else |
1138 | { | 1150 | { |
1139 | m_lastUpdateSent = false; | 1151 | m_lastUpdateSent = false; |
1140 | vec = d.BodyGetLinearVel(Body); | 1152 | try |
1153 | { | ||
1154 | vec = d.BodyGetLinearVel(Body); | ||
1155 | } | ||
1156 | catch (NullReferenceException) | ||
1157 | { | ||
1158 | vec.X = _velocity.X; | ||
1159 | vec.Y = _velocity.Y; | ||
1160 | vec.Z = _velocity.Z; | ||
1161 | } | ||
1141 | _velocity.X = (vec.X); | 1162 | _velocity.X = (vec.X); |
1142 | _velocity.Y = (vec.Y); | 1163 | _velocity.Y = (vec.Y); |
1143 | 1164 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 7840ae3..864ea80 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -827,8 +827,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
827 | IntPtr vertices, indices; | 827 | IntPtr vertices, indices; |
828 | int vertexCount, indexCount; | 828 | int vertexCount, indexCount; |
829 | int vertexStride, triStride; | 829 | int vertexStride, triStride; |
830 | mesh.getVertexListAsPtrToFloatArray( out vertices, out vertexStride, out vertexCount ); // Note, that vertices are fixed in unmanaged heap | 830 | mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap |
831 | mesh.getIndexListAsPtrToIntArray( out indices, out triStride, out indexCount ); // Also fixed, needs release after usage | 831 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage |
832 | 832 | ||
833 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory | 833 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory |
834 | 834 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 78831f8..9429544 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -243,6 +243,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
243 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); | 243 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); |
244 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 244 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
245 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); | 245 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); |
246 | private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); | ||
246 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); | 247 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); |
247 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); | 248 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); |
248 | private bool m_NINJA_physics_joints_enabled = false; | 249 | private bool m_NINJA_physics_joints_enabled = false; |
@@ -1678,6 +1679,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1678 | } | 1679 | } |
1679 | } | 1680 | } |
1680 | } | 1681 | } |
1682 | public void BadCharacter(OdeCharacter chr) | ||
1683 | { | ||
1684 | lock (_badCharacter) | ||
1685 | { | ||
1686 | if (!_badCharacter.Contains(chr)) | ||
1687 | _badCharacter.Add(chr); | ||
1688 | } | ||
1689 | } | ||
1681 | 1690 | ||
1682 | public override void RemoveAvatar(PhysicsActor actor) | 1691 | public override void RemoveAvatar(PhysicsActor actor) |
1683 | { | 1692 | { |
@@ -2987,6 +2996,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2987 | } | 2996 | } |
2988 | } | 2997 | } |
2989 | 2998 | ||
2999 | lock (_badCharacter) | ||
3000 | { | ||
3001 | if (_badCharacter.Count > 0) | ||
3002 | { | ||
3003 | foreach (OdeCharacter chr in _badCharacter) | ||
3004 | { | ||
3005 | RemoveCharacter(chr); | ||
3006 | } | ||
3007 | _badCharacter.Clear(); | ||
3008 | } | ||
3009 | } | ||
3010 | |||
2990 | lock (_activeprims) | 3011 | lock (_activeprims) |
2991 | { | 3012 | { |
2992 | //if (timeStep < 0.2f) | 3013 | //if (timeStep < 0.2f) |
@@ -3792,7 +3813,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3792 | } | 3813 | } |
3793 | 3814 | ||
3794 | public void start(int unused) | 3815 | public void start(int unused) |
3795 | { | 3816 | { |
3796 | ds.SetViewpoint(ref xyz, ref hpr); | 3817 | ds.SetViewpoint(ref xyz, ref hpr); |
3797 | } | 3818 | } |
3798 | #endif | 3819 | #endif |