diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index aa208e2..e080b18 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -196,8 +196,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
196 | 196 | ||
197 | private int m_eventsubscription; | 197 | private int m_eventsubscription; |
198 | private int m_cureventsubscription; | 198 | private int m_cureventsubscription; |
199 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 199 | private CollisionEventUpdate CollisionEvents = null; |
200 | private CollisionEventUpdate CollisionVDTCEventsThisFrame = null; | 200 | private CollisionEventUpdate CollisionVDTCEvents = null; |
201 | private bool SentEmptyCollisionsEvent; | 201 | private bool SentEmptyCollisionsEvent; |
202 | 202 | ||
203 | public volatile bool childPrim; | 203 | public volatile bool childPrim; |
@@ -1138,24 +1138,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1138 | { | 1138 | { |
1139 | m_eventsubscription = ms; | 1139 | m_eventsubscription = ms; |
1140 | m_cureventsubscription = 0; | 1140 | m_cureventsubscription = 0; |
1141 | if (CollisionEventsThisFrame == null) | 1141 | if (CollisionEvents == null) |
1142 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1142 | CollisionEvents = new CollisionEventUpdate(); |
1143 | if (CollisionVDTCEventsThisFrame == null) | 1143 | if (CollisionVDTCEvents == null) |
1144 | CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); | 1144 | CollisionVDTCEvents = new CollisionEventUpdate(); |
1145 | SentEmptyCollisionsEvent = false; | 1145 | SentEmptyCollisionsEvent = false; |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | public override void UnSubscribeEvents() | 1148 | public override void UnSubscribeEvents() |
1149 | { | 1149 | { |
1150 | if (CollisionVDTCEventsThisFrame != null) | 1150 | if (CollisionVDTCEvents != null) |
1151 | { | 1151 | { |
1152 | CollisionVDTCEventsThisFrame.Clear(); | 1152 | CollisionVDTCEvents.Clear(); |
1153 | CollisionVDTCEventsThisFrame = null; | 1153 | CollisionVDTCEvents = null; |
1154 | } | 1154 | } |
1155 | if (CollisionEventsThisFrame != null) | 1155 | if (CollisionEvents != null) |
1156 | { | 1156 | { |
1157 | CollisionEventsThisFrame.Clear(); | 1157 | CollisionEvents.Clear(); |
1158 | CollisionEventsThisFrame = null; | 1158 | CollisionEvents = null; |
1159 | } | 1159 | } |
1160 | m_eventsubscription = 0; | 1160 | m_eventsubscription = 0; |
1161 | _parent_scene.RemoveCollisionEventReporting(this); | 1161 | _parent_scene.RemoveCollisionEventReporting(this); |
@@ -1163,27 +1163,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1163 | 1163 | ||
1164 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 1164 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
1165 | { | 1165 | { |
1166 | if (CollisionEventsThisFrame == null) | 1166 | if (CollisionEvents == null) |
1167 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1167 | CollisionEvents = new CollisionEventUpdate(); |
1168 | 1168 | ||
1169 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 1169 | CollisionEvents.AddCollider(CollidedWith, contact); |
1170 | _parent_scene.AddCollisionEventReporting(this); | 1170 | _parent_scene.AddCollisionEventReporting(this); |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) | 1173 | public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) |
1174 | { | 1174 | { |
1175 | if (CollisionVDTCEventsThisFrame == null) | 1175 | if (CollisionVDTCEvents == null) |
1176 | CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); | 1176 | CollisionVDTCEvents = new CollisionEventUpdate(); |
1177 | 1177 | ||
1178 | CollisionVDTCEventsThisFrame.AddCollider(CollidedWith, contact); | 1178 | CollisionVDTCEvents.AddCollider(CollidedWith, contact); |
1179 | _parent_scene.AddCollisionEventReporting(this); | 1179 | _parent_scene.AddCollisionEventReporting(this); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | internal void SleeperAddCollisionEvents() | 1182 | internal void SleeperAddCollisionEvents() |
1183 | { | 1183 | { |
1184 | if(CollisionEventsThisFrame != null && CollisionEventsThisFrame.m_objCollisionList.Count != 0) | 1184 | if(CollisionEvents != null && CollisionEvents.m_objCollisionList.Count != 0) |
1185 | { | 1185 | { |
1186 | foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList) | 1186 | foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEvents.m_objCollisionList) |
1187 | { | 1187 | { |
1188 | if(kvp.Key == 0) | 1188 | if(kvp.Key == 0) |
1189 | continue; | 1189 | continue; |
@@ -1196,9 +1196,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1196 | other.AddCollisionEvent(ParentActor.LocalID,cp); | 1196 | other.AddCollisionEvent(ParentActor.LocalID,cp); |
1197 | } | 1197 | } |
1198 | } | 1198 | } |
1199 | if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.m_objCollisionList.Count != 0) | 1199 | if(CollisionVDTCEvents != null && CollisionVDTCEvents.m_objCollisionList.Count != 0) |
1200 | { | 1200 | { |
1201 | foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEventsThisFrame.m_objCollisionList) | 1201 | foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEvents.m_objCollisionList) |
1202 | { | 1202 | { |
1203 | OdePrim other = _parent_scene.getPrim(kvp.Key); | 1203 | OdePrim other = _parent_scene.getPrim(kvp.Key); |
1204 | if(other == null) | 1204 | if(other == null) |
@@ -1213,8 +1213,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1213 | 1213 | ||
1214 | internal void clearSleeperCollisions() | 1214 | internal void clearSleeperCollisions() |
1215 | { | 1215 | { |
1216 | if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 ) | 1216 | if(CollisionVDTCEvents != null && CollisionVDTCEvents.Count >0 ) |
1217 | CollisionVDTCEventsThisFrame.Clear(); | 1217 | CollisionVDTCEvents.Clear(); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | public void SendCollisions(int timestep) | 1220 | public void SendCollisions(int timestep) |
@@ -1226,14 +1226,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1226 | if (m_cureventsubscription < m_eventsubscription) | 1226 | if (m_cureventsubscription < m_eventsubscription) |
1227 | return; | 1227 | return; |
1228 | 1228 | ||
1229 | if (CollisionEventsThisFrame == null) | 1229 | if (CollisionEvents == null) |
1230 | return; | 1230 | return; |
1231 | 1231 | ||
1232 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; | 1232 | int ncolisions = CollisionEvents.m_objCollisionList.Count; |
1233 | 1233 | ||
1234 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | 1234 | if (!SentEmptyCollisionsEvent || ncolisions > 0) |
1235 | { | 1235 | { |
1236 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1236 | base.SendCollisionUpdate(CollisionEvents); |
1237 | m_cureventsubscription = 0; | 1237 | m_cureventsubscription = 0; |
1238 | 1238 | ||
1239 | if (ncolisions == 0) | 1239 | if (ncolisions == 0) |
@@ -1244,7 +1244,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1244 | else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) | 1244 | else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) |
1245 | { | 1245 | { |
1246 | SentEmptyCollisionsEvent = false; | 1246 | SentEmptyCollisionsEvent = false; |
1247 | CollisionEventsThisFrame.Clear(); | 1247 | CollisionEvents.Clear(); |
1248 | } | 1248 | } |
1249 | } | 1249 | } |
1250 | } | 1250 | } |
@@ -1832,7 +1832,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1832 | // should only be called for non physical prims unless they are becoming non physical | 1832 | // should only be called for non physical prims unless they are becoming non physical |
1833 | private void SetInStaticSpace(OdePrim prim) | 1833 | private void SetInStaticSpace(OdePrim prim) |
1834 | { | 1834 | { |
1835 | IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim._position, prim.m_targetSpace); | 1835 | IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim.m_targetSpace); |
1836 | prim.m_targetSpace = targetSpace; | 1836 | prim.m_targetSpace = targetSpace; |
1837 | collide_geom = IntPtr.Zero; | 1837 | collide_geom = IntPtr.Zero; |
1838 | } | 1838 | } |
@@ -2069,8 +2069,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2069 | } | 2069 | } |
2070 | else | 2070 | else |
2071 | { | 2071 | { |
2072 | m_targetSpace = d.HashSpaceCreate(_parent_scene.ActiveSpace); | 2072 | m_targetSpace = d.SimpleSpaceCreate(_parent_scene.ActiveSpace); |
2073 | d.HashSpaceSetLevels(m_targetSpace, -2, 8); | ||
2074 | d.SpaceSetSublevel(m_targetSpace, 3); | 2073 | d.SpaceSetSublevel(m_targetSpace, 3); |
2075 | d.SpaceSetCleanup(m_targetSpace, false); | 2074 | d.SpaceSetCleanup(m_targetSpace, false); |
2076 | 2075 | ||
@@ -2964,7 +2963,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2964 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); | 2963 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); |
2965 | _position = newPos; | 2964 | _position = newPos; |
2966 | 2965 | ||
2967 | m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); | 2966 | m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); |
2968 | } | 2967 | } |
2969 | } | 2968 | } |
2970 | } | 2969 | } |
@@ -3103,7 +3102,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3103 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); | 3102 | d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); |
3104 | _position = newPos; | 3103 | _position = newPos; |
3105 | 3104 | ||
3106 | m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); | 3105 | m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); |
3107 | } | 3106 | } |
3108 | } | 3107 | } |
3109 | } | 3108 | } |