diff options
author | UbitUmarov | 2012-07-13 23:57:45 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-13 23:57:45 +0100 |
commit | 72e2b9409462861d183ac7b391f5911defcd3bb0 (patch) | |
tree | 8e150a48fd887300750a51edb7cb213b70f89acc /OpenSim/Region/Physics/UbitOdePlugin | |
parent | missed fix on vehicle reference frame (diff) | |
download | opensim-SC_OLD-72e2b9409462861d183ac7b391f5911defcd3bb0.zip opensim-SC_OLD-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.gz opensim-SC_OLD-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.bz2 opensim-SC_OLD-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.xz |
In collisions report linksets root parts to parts, and not all parts.
Temporary suspend collision checks on full stopped bodies, until a better
away is found wake them, avoiding spurius collision end and start events.
Until a nice way is found to avoid them, this may cause some higher cpu load. plus some clean up
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin')
4 files changed, 45 insertions, 41 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 865180f..b506b1c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
95 | private bool m_iscollidingObj = false; | 95 | private bool m_iscollidingObj = false; |
96 | private bool m_alwaysRun = false; | 96 | private bool m_alwaysRun = false; |
97 | private int m_requestedUpdateFrequency = 0; | 97 | private int m_requestedUpdateFrequency = 0; |
98 | public uint m_localID = 0; | 98 | private uint m_localID = 0; |
99 | public bool m_returnCollisions = false; | 99 | public bool m_returnCollisions = false; |
100 | // taints and their non-tainted counterparts | 100 | // taints and their non-tainted counterparts |
101 | public bool m_isPhysical = false; // the current physical status | 101 | public bool m_isPhysical = false; // the current physical status |
@@ -214,6 +214,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
214 | 214 | ||
215 | public override uint LocalID | 215 | public override uint LocalID |
216 | { | 216 | { |
217 | get { return m_localID; } | ||
217 | set { m_localID = value; } | 218 | set { m_localID = value; } |
218 | } | 219 | } |
219 | 220 | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 8d5f269..6d322e2 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -101,7 +101,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
101 | private float m_invTimeStep = 50.0f; | 101 | private float m_invTimeStep = 50.0f; |
102 | private float m_timeStep = .02f; | 102 | private float m_timeStep = .02f; |
103 | 103 | ||
104 | |||
105 | private Vector3 m_PIDTarget; | 104 | private Vector3 m_PIDTarget; |
106 | private float m_PIDTau; | 105 | private float m_PIDTau; |
107 | private bool m_usePID; | 106 | private bool m_usePID; |
@@ -119,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
119 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 118 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
120 | 119 | ||
121 | private int body_autodisable_frames = 5; | 120 | private int body_autodisable_frames = 5; |
122 | private int bodydisablecontrol = 0; | 121 | public int bodydisablecontrol = 0; |
123 | 122 | ||
124 | 123 | ||
125 | // Default we're a Geometry | 124 | // Default we're a Geometry |
@@ -144,7 +143,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
144 | 143 | ||
145 | public bool m_disabled; | 144 | public bool m_disabled; |
146 | 145 | ||
147 | public uint m_localID; | 146 | private uint m_localID; |
148 | 147 | ||
149 | private IMesh m_mesh; | 148 | private IMesh m_mesh; |
150 | private object m_meshlock = new object(); | 149 | private object m_meshlock = new object(); |
@@ -167,7 +166,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
167 | // private bool m_throttleUpdates; | 166 | // private bool m_throttleUpdates; |
168 | // private int throttleCounter; | 167 | // private int throttleCounter; |
169 | public float m_collisionscore; | 168 | public float m_collisionscore; |
170 | int m_colliderfilter = 0; | 169 | private int m_colliderfilter = 0; |
171 | 170 | ||
172 | public IntPtr collide_geom; // for objects: geom if single prim space it linkset | 171 | public IntPtr collide_geom; // for objects: geom if single prim space it linkset |
173 | 172 | ||
@@ -235,7 +234,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
235 | } | 234 | } |
236 | } | 235 | } |
237 | 236 | ||
238 | |||
239 | public override bool Phantom // this is not reliable for internal use | 237 | public override bool Phantom // this is not reliable for internal use |
240 | { | 238 | { |
241 | get { return m_fakeisphantom; } | 239 | get { return m_fakeisphantom; } |
@@ -293,14 +291,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
293 | 291 | ||
294 | public override uint LocalID | 292 | public override uint LocalID |
295 | { | 293 | { |
294 | get { return m_localID; } | ||
295 | set { m_localID = value; } | ||
296 | } | ||
297 | |||
298 | public OdePrim Parent | ||
299 | { | ||
296 | get | 300 | get |
297 | { | 301 | { |
298 | return m_localID; | 302 | if (childPrim) |
299 | } | 303 | return (OdePrim)_parent; |
300 | set | 304 | else |
301 | { | 305 | return this; |
302 | //m_log.Info("[PHYSICS]: Setting TrackerID: " + value); | ||
303 | m_localID = value; | ||
304 | } | 306 | } |
305 | } | 307 | } |
306 | 308 | ||
@@ -945,8 +947,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
945 | CollisionEventsThisFrame = null; | 947 | CollisionEventsThisFrame = null; |
946 | } | 948 | } |
947 | m_eventsubscription = 0; | 949 | m_eventsubscription = 0; |
948 | // for now still done on odescene | 950 | _parent_scene.RemoveCollisionEventReporting(this); |
949 | // _parent_scene.RemoveCollisionEventReporting(this); | ||
950 | } | 951 | } |
951 | 952 | ||
952 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 953 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
@@ -980,10 +981,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
980 | } | 981 | } |
981 | else | 982 | else |
982 | { | 983 | { |
983 | if (ncolisions > 10) | ||
984 | { | ||
985 | } | ||
986 | |||
987 | SentEmptyCollisionsEvent = false; | 984 | SentEmptyCollisionsEvent = false; |
988 | CollisionEventsThisFrame.Clear(); | 985 | CollisionEventsThisFrame.Clear(); |
989 | } | 986 | } |
@@ -1832,8 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1832 | { | 1829 | { |
1833 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); | 1830 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); |
1834 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | 1831 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); |
1835 | } | 1832 | } |
1836 | |||
1837 | _parent_scene.addActiveGroups(this); | 1833 | _parent_scene.addActiveGroups(this); |
1838 | } | 1834 | } |
1839 | 1835 | ||
@@ -3700,6 +3696,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3700 | d.BodySetAngularVel(Body, 0, 0, 0); | 3696 | d.BodySetAngularVel(Body, 0, 0, 0); |
3701 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 3697 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
3702 | disableBodySoft(); // stop collisions | 3698 | disableBodySoft(); // stop collisions |
3699 | UnSubscribeEvents(); | ||
3700 | |||
3703 | base.RequestPhysicsterseUpdate(); | 3701 | base.RequestPhysicsterseUpdate(); |
3704 | return; | 3702 | return; |
3705 | } | 3703 | } |
@@ -3871,8 +3869,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3871 | m_vehicle = null; | 3869 | m_vehicle = null; |
3872 | RemoveGeom(); | 3870 | RemoveGeom(); |
3873 | m_targetSpace = IntPtr.Zero; | 3871 | m_targetSpace = IntPtr.Zero; |
3874 | if (m_eventsubscription > 0) | 3872 | UnSubscribeEvents(); |
3875 | UnSubscribeEvents(); | ||
3876 | return true; | 3873 | return true; |
3877 | 3874 | ||
3878 | case changes.Link: | 3875 | case changes.Link: |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 5122ebf..3d108f8 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |||
@@ -509,14 +509,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
509 | if ((thisFlags & CurrentRayFilter) == 0) | 509 | if ((thisFlags & CurrentRayFilter) == 0) |
510 | return; | 510 | return; |
511 | 511 | ||
512 | ID = ((OdePrim)p2).m_localID; | 512 | ID = ((OdePrim)p2).LocalID; |
513 | } | 513 | } |
514 | else if (p2 is OdeCharacter) | 514 | else if (p2 is OdeCharacter) |
515 | { | 515 | { |
516 | if ((CurrentRayFilter & RayFilterFlags.agent) == 0) | 516 | if ((CurrentRayFilter & RayFilterFlags.agent) == 0) |
517 | return; | 517 | return; |
518 | else | 518 | else |
519 | ID = ((OdeCharacter)p2).m_localID; | 519 | ID = ((OdeCharacter)p2).LocalID; |
520 | } | 520 | } |
521 | else //?? | 521 | else //?? |
522 | return; | 522 | return; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 088d2ba..659180d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -1171,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1171 | OdePrim cp1; | 1171 | OdePrim cp1; |
1172 | OdeCharacter cc2; | 1172 | OdeCharacter cc2; |
1173 | OdePrim cp2; | 1173 | OdePrim cp2; |
1174 | OdePrim cp1Parent; | ||
1175 | OdePrim cp2Parent; | ||
1174 | 1176 | ||
1175 | uint obj2LocalID = 0; | 1177 | uint obj2LocalID = 0; |
1176 | bool p1events = p1.SubscribedEvents(); | 1178 | bool p1events = p1.SubscribedEvents(); |
@@ -1207,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1207 | { | 1209 | { |
1208 | case ActorTypes.Agent: | 1210 | case ActorTypes.Agent: |
1209 | cc2 = (OdeCharacter)p2; | 1211 | cc2 = (OdeCharacter)p2; |
1210 | obj2LocalID = cc2.m_localID; | 1212 | obj2LocalID = cc2.LocalID; |
1211 | if (p2events) | 1213 | if (p2events) |
1212 | cc2.AddCollisionEvent(cc1.m_localID, contact); | 1214 | cc2.AddCollisionEvent(cc1.LocalID, contact); |
1213 | break; | 1215 | break; |
1214 | 1216 | ||
1215 | case ActorTypes.Prim: | 1217 | case ActorTypes.Prim: |
1216 | if (p2 is OdePrim) | 1218 | if (p2 is OdePrim) |
1217 | { | 1219 | { |
1218 | cp2 = (OdePrim)p2; | 1220 | cp2 = (OdePrim)p2; |
1219 | obj2LocalID = cp2.m_localID; | ||
1220 | if (p2events) | 1221 | if (p2events) |
1221 | cp2.AddCollisionEvent(cc1.m_localID, contact); | 1222 | cp2.AddCollisionEvent(cc1.LocalID, contact); |
1223 | cp2 = cp2.Parent; | ||
1224 | obj2LocalID = cp2.LocalID; | ||
1222 | } | 1225 | } |
1223 | break; | 1226 | break; |
1224 | 1227 | ||
@@ -1240,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1240 | if (p1 is OdePrim) | 1243 | if (p1 is OdePrim) |
1241 | { | 1244 | { |
1242 | cp1 = (OdePrim)p1; | 1245 | cp1 = (OdePrim)p1; |
1243 | 1246 | cp1Parent = cp1.Parent; | |
1244 | // obj1LocalID = cp2.m_localID; | ||
1245 | switch ((ActorTypes)p2.PhysicsActorType) | 1247 | switch ((ActorTypes)p2.PhysicsActorType) |
1246 | { | 1248 | { |
1247 | case ActorTypes.Agent: | 1249 | case ActorTypes.Agent: |
1248 | if (p2 is OdeCharacter) | 1250 | if (p2 is OdeCharacter) |
1249 | { | 1251 | { |
1250 | cc2 = (OdeCharacter)p2; | 1252 | cc2 = (OdeCharacter)p2; |
1251 | obj2LocalID = cc2.m_localID; | 1253 | obj2LocalID = cc2.LocalID; |
1252 | if (p2events) | 1254 | if (p2events) |
1253 | cc2.AddCollisionEvent(cp1.m_localID, contact); | 1255 | cc2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1254 | } | 1256 | } |
1255 | break; | 1257 | break; |
1256 | case ActorTypes.Prim: | 1258 | case ActorTypes.Prim: |
@@ -1258,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1258 | if (p2 is OdePrim) | 1260 | if (p2 is OdePrim) |
1259 | { | 1261 | { |
1260 | cp2 = (OdePrim)p2; | 1262 | cp2 = (OdePrim)p2; |
1261 | obj2LocalID = cp2.m_localID; | ||
1262 | if (p2events) | 1263 | if (p2events) |
1263 | cp2.AddCollisionEvent(cp1.m_localID, contact); | 1264 | cp2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1265 | cp2 = cp2.Parent; | ||
1266 | obj2LocalID = cp2.LocalID; | ||
1264 | } | 1267 | } |
1265 | break; | 1268 | break; |
1266 | 1269 | ||
@@ -1286,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1286 | if (p2 is OdeCharacter) | 1289 | if (p2 is OdeCharacter) |
1287 | { | 1290 | { |
1288 | cc2 = (OdeCharacter)p2; | 1291 | cc2 = (OdeCharacter)p2; |
1289 | obj2LocalID = cc2.m_localID; | 1292 | obj2LocalID = cc2.LocalID; |
1290 | if (p2events) | 1293 | if (p2events) |
1291 | cc2.AddCollisionEvent(0, contact); | 1294 | cc2.AddCollisionEvent(0, contact); |
1292 | } | 1295 | } |
@@ -1295,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1295 | if (p2 is OdePrim) | 1298 | if (p2 is OdePrim) |
1296 | { | 1299 | { |
1297 | cp2 = (OdePrim)p2; | 1300 | cp2 = (OdePrim)p2; |
1298 | obj2LocalID = cp2.m_localID; | 1301 | obj2LocalID = cp2.LocalID; |
1299 | if (p2events) | 1302 | if (p2events) |
1300 | cp2.AddCollisionEvent(0, contact); | 1303 | cp2.AddCollisionEvent(0, contact); |
1301 | } | 1304 | } |
@@ -1350,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1350 | { | 1353 | { |
1351 | foreach (OdePrim prm in _activegroups) | 1354 | foreach (OdePrim prm in _activegroups) |
1352 | { | 1355 | { |
1353 | if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) | 1356 | if (!prm.m_outbounds) |
1354 | d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); | 1357 | { |
1358 | // if (d.BodyIsEnabled(prm.Body)) | ||
1359 | d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); | ||
1360 | } | ||
1355 | } | 1361 | } |
1356 | } | 1362 | } |
1357 | catch (AccessViolationException) | 1363 | catch (AccessViolationException) |
@@ -1604,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1604 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 1610 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); |
1605 | lock (prim) | 1611 | lock (prim) |
1606 | { | 1612 | { |
1607 | RemoveCollisionEventReporting(prim); | 1613 | // RemoveCollisionEventReporting(prim); |
1608 | lock (_prims) | 1614 | lock (_prims) |
1609 | _prims.Remove(prim); | 1615 | _prims.Remove(prim); |
1610 | } | 1616 | } |
@@ -2012,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2012 | case ActorTypes.Prim: | 2018 | case ActorTypes.Prim: |
2013 | OdePrim pobj = (OdePrim)obj; | 2019 | OdePrim pobj = (OdePrim)obj; |
2014 | if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) | 2020 | if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) |
2021 | if (!pobj.m_outbounds) | ||
2015 | { | 2022 | { |
2016 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); | 2023 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); |
2017 | pobj.SendCollisions(); | 2024 | pobj.SendCollisions(); |
@@ -2728,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2728 | WaterMapHandler.Free(); | 2735 | WaterMapHandler.Free(); |
2729 | } | 2736 | } |
2730 | 2737 | ||
2731 | |||
2732 | if (ContactgeomsArray != IntPtr.Zero) | 2738 | if (ContactgeomsArray != IntPtr.Zero) |
2733 | Marshal.FreeHGlobal(ContactgeomsArray); | 2739 | Marshal.FreeHGlobal(ContactgeomsArray); |
2734 | if (GlobalContactsArray != IntPtr.Zero) | 2740 | if (GlobalContactsArray != IntPtr.Zero) |
@@ -2751,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2751 | { | 2757 | { |
2752 | if (prm.CollisionScore > 0) | 2758 | if (prm.CollisionScore > 0) |
2753 | { | 2759 | { |
2754 | returncolliders.Add(prm.m_localID, prm.CollisionScore); | 2760 | returncolliders.Add(prm.LocalID, prm.CollisionScore); |
2755 | cnt++; | 2761 | cnt++; |
2756 | prm.CollisionScore = 0f; | 2762 | prm.CollisionScore = 0f; |
2757 | if (cnt > 25) | 2763 | if (cnt > 25) |