aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin
diff options
context:
space:
mode:
authorMelanie2012-07-16 22:22:42 +0100
committerMelanie2012-07-16 22:22:42 +0100
commitc256447f46db1738131763960c9394f03b072c46 (patch)
tree277255a693b3ce62366816338482a602d7d979bf /OpenSim/Region/Physics/UbitOdePlugin
parentMerge branch 'master' into careminster (diff)
parentAllow setting linked avatar positions from within a prim not the one sat on (diff)
downloadopensim-SC-c256447f46db1738131763960c9394f03b072c46.zip
opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.gz
opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.bz2
opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.xz
Merge branch 'avination' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs3
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs3
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs154
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs4
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs54
6 files changed, 84 insertions, 136 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/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index e900c02..a7dda7a 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -425,7 +425,8 @@ namespace OpenSim.Region.Physics.OdePlugin
425 switch (pParam) 425 switch (pParam)
426 { 426 {
427 case Vehicle.REFERENCE_FRAME: 427 case Vehicle.REFERENCE_FRAME:
428 m_referenceFrame = Quaternion.Inverse(pValue); 428 // m_referenceFrame = Quaternion.Inverse(pValue);
429 m_referenceFrame = pValue;
429 break; 430 break;
430 case Vehicle.ROLL_FRAME: 431 case Vehicle.ROLL_FRAME:
431 m_RollreferenceFrame = pValue; 432 m_RollreferenceFrame = pValue;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index ff17a6e..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
@@ -134,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin
134 133
135// private bool m_collidesLand = true; 134// private bool m_collidesLand = true;
136 private bool m_collidesWater; 135 private bool m_collidesWater;
137 public bool m_returnCollisions; 136// public bool m_returnCollisions;
138 137
139 private bool m_NoColide; // for now only for internal use for bad meshs 138 private bool m_NoColide; // for now only for internal use for bad meshs
140 139
@@ -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();
@@ -164,10 +163,10 @@ namespace OpenSim.Region.Physics.OdePlugin
164 private List<OdePrim> childrenPrim = new List<OdePrim>(); 163 private List<OdePrim> childrenPrim = new List<OdePrim>();
165 164
166 165
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
@@ -363,12 +365,14 @@ namespace OpenSim.Region.Physics.OdePlugin
363 set { return; } 365 set { return; }
364 } 366 }
365 367
366 public override bool ThrottleUpdates 368
369 public override bool ThrottleUpdates {get;set;}
370/*
367 { 371 {
368 get { return m_throttleUpdates; } 372 get { return m_throttleUpdates; }
369 set { m_throttleUpdates = value; } 373 set { m_throttleUpdates = value; }
370 } 374 }
371 375*/
372 public override bool Stopped 376 public override bool Stopped
373 { 377 {
374 get { return _zeroFlag; } 378 get { return _zeroFlag; }
@@ -943,15 +947,15 @@ namespace OpenSim.Region.Physics.OdePlugin
943 CollisionEventsThisFrame = null; 947 CollisionEventsThisFrame = null;
944 } 948 }
945 m_eventsubscription = 0; 949 m_eventsubscription = 0;
946 // for now still done on odescene 950 _parent_scene.RemoveCollisionEventReporting(this);
947// _parent_scene.RemoveCollisionEventReporting(this);
948 } 951 }
949 952
950 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 953 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
951 { 954 {
952 if (CollisionEventsThisFrame == null) 955 if (CollisionEventsThisFrame == null)
953 CollisionEventsThisFrame = new CollisionEventUpdate(); 956 CollisionEventsThisFrame = new CollisionEventUpdate();
954 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 957// if(CollisionEventsThisFrame.Count < 32)
958 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
955 } 959 }
956 960
957 public void SendCollisions() 961 public void SendCollisions()
@@ -1746,8 +1750,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1746 if (childrenPrim.Count == 0) 1750 if (childrenPrim.Count == 0)
1747 { 1751 {
1748 collide_geom = prim_geom; 1752 collide_geom = prim_geom;
1749 m_targetSpace = _parent_scene.ActiveSpace; 1753 m_targetSpace = _parent_scene.ActiveSpace;
1750 d.SpaceAdd(m_targetSpace, prim_geom);
1751 } 1754 }
1752 else 1755 else
1753 { 1756 {
@@ -1755,7 +1758,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1755 d.HashSpaceSetLevels(m_targetSpace, -2, 8); 1758 d.HashSpaceSetLevels(m_targetSpace, -2, 8);
1756 d.SpaceSetSublevel(m_targetSpace, 3); 1759 d.SpaceSetSublevel(m_targetSpace, 3);
1757 d.SpaceSetCleanup(m_targetSpace, false); 1760 d.SpaceSetCleanup(m_targetSpace, false);
1758 d.SpaceAdd(m_targetSpace, prim_geom);
1759 1761
1760 d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | 1762 d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space |
1761 CollisionCategories.Geom | 1763 CollisionCategories.Geom |
@@ -1766,12 +1768,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1766 collide_geom = m_targetSpace; 1768 collide_geom = m_targetSpace;
1767 } 1769 }
1768 1770
1771 d.SpaceAdd(m_targetSpace, prim_geom);
1772
1769 if (m_delaySelect) 1773 if (m_delaySelect)
1770 { 1774 {
1771 m_isSelected = true; 1775 m_isSelected = true;
1772 m_delaySelect = false; 1776 m_delaySelect = false;
1773 } 1777 }
1774 1778
1779 m_collisionscore = 0;
1780
1781 UpdateCollisionCatFlags();
1782 ApplyCollisionCatFlags();
1783
1784 _parent_scene.addActivePrim(this);
1785
1775 lock (childrenPrim) 1786 lock (childrenPrim)
1776 { 1787 {
1777 foreach (OdePrim prm in childrenPrim) 1788 foreach (OdePrim prm in childrenPrim)
@@ -1809,10 +1820,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1809 createAMotor(m_angularlock); 1820 createAMotor(m_angularlock);
1810 } 1821 }
1811 1822
1812 m_collisionscore = 0;
1813
1814 UpdateCollisionCatFlags();
1815 ApplyCollisionCatFlags();
1816 1823
1817 if (m_isSelected || m_disabled) 1824 if (m_isSelected || m_disabled)
1818 { 1825 {
@@ -1822,9 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1822 { 1829 {
1823 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);
1824 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); 1831 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
1825 } 1832 }
1826
1827 _parent_scene.addActivePrim(this);
1828 _parent_scene.addActiveGroups(this); 1833 _parent_scene.addActiveGroups(this);
1829 } 1834 }
1830 1835
@@ -3441,92 +3446,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3441 if (++bodydisablecontrol < 20) 3446 if (++bodydisablecontrol < 20)
3442 return; 3447 return;
3443 3448
3444 bodydisablecontrol = 0; 3449
3445 d.BodyEnable(Body); 3450 d.BodyEnable(Body);
3446 } 3451 }
3447 3452
3448 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator 3453 bodydisablecontrol = 0;
3449
3450/* moved down to UpdateMove... where it belongs again
3451
3452 // check outside region
3453
3454 if (lpos.Z < -100 || lpos.Z > 100000f)
3455 {
3456 m_outbounds = true;
3457
3458 lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
3459 _acceleration.X = 0;
3460 _acceleration.Y = 0;
3461 _acceleration.Z = 0;
3462
3463 _velocity.X = 0;
3464 _velocity.Y = 0;
3465 _velocity.Z = 0;
3466 m_rotationalVelocity.X = 0;
3467 m_rotationalVelocity.Y = 0;
3468 m_rotationalVelocity.Z = 0;
3469
3470 d.BodySetLinearVel(Body, 0, 0, 0); // stop it
3471 d.BodySetAngularVel(Body, 0, 0, 0); // stop it
3472 d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere
3473 m_lastposition = _position;
3474 m_lastorientation = _orientation;
3475
3476 base.RequestPhysicsterseUpdate();
3477
3478 throttleCounter = 0;
3479 _zeroFlag = true;
3480
3481 disableBodySoft(); // disable it and colisions
3482 base.RaiseOutOfBounds(_position);
3483 return;
3484 }
3485
3486 if (lpos.X < 0f)
3487 {
3488 _position.X = Util.Clip(lpos.X, -2f, -0.1f);
3489 m_outbounds = true;
3490 }
3491 else if (lpos.X > _parent_scene.WorldExtents.X)
3492 {
3493 _position.X = Util.Clip(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f);
3494 m_outbounds = true;
3495 }
3496 if (lpos.Y < 0f)
3497 {
3498 _position.Y = Util.Clip(lpos.Y, -2f, -0.1f);
3499 m_outbounds = true;
3500 }
3501 else if (lpos.Y > _parent_scene.WorldExtents.Y)
3502 {
3503 _position.Y = Util.Clip(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f);
3504 m_outbounds = true;
3505 }
3506
3507 if (m_outbounds)
3508 {
3509 m_lastposition = _position;
3510 m_lastorientation = _orientation;
3511
3512 d.Vector3 dtmp = d.BodyGetAngularVel(Body);
3513 m_rotationalVelocity.X = dtmp.X;
3514 m_rotationalVelocity.Y = dtmp.Y;
3515 m_rotationalVelocity.Z = dtmp.Z;
3516 3454
3517 dtmp = d.BodyGetLinearVel(Body); 3455 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
3518 _velocity.X = dtmp.X;
3519 _velocity.Y = dtmp.Y;
3520 _velocity.Z = dtmp.Z;
3521 3456
3522 d.BodySetLinearVel(Body, 0, 0, 0); // stop it
3523 d.BodySetAngularVel(Body, 0, 0, 0);
3524 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3525 disableBodySoft(); // stop collisions
3526 base.RequestPhysicsterseUpdate();
3527 return;
3528 }
3529*/
3530 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) 3457 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
3531 { 3458 {
3532 // 'VEHICLES' are dealt with in ODEDynamics.cs 3459 // 'VEHICLES' are dealt with in ODEDynamics.cs
@@ -3721,7 +3648,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3721 3648
3722 base.RequestPhysicsterseUpdate(); 3649 base.RequestPhysicsterseUpdate();
3723 3650
3724 throttleCounter = 0; 3651// throttleCounter = 0;
3725 _zeroFlag = true; 3652 _zeroFlag = true;
3726 3653
3727 disableBodySoft(); // disable it and colisions 3654 disableBodySoft(); // disable it and colisions
@@ -3769,6 +3696,8 @@ namespace OpenSim.Region.Physics.OdePlugin
3769 d.BodySetAngularVel(Body, 0, 0, 0); 3696 d.BodySetAngularVel(Body, 0, 0, 0);
3770 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 3697 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3771 disableBodySoft(); // stop collisions 3698 disableBodySoft(); // stop collisions
3699 UnSubscribeEvents();
3700
3772 base.RequestPhysicsterseUpdate(); 3701 base.RequestPhysicsterseUpdate();
3773 return; 3702 return;
3774 } 3703 }
@@ -3940,8 +3869,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3940 m_vehicle = null; 3869 m_vehicle = null;
3941 RemoveGeom(); 3870 RemoveGeom();
3942 m_targetSpace = IntPtr.Zero; 3871 m_targetSpace = IntPtr.Zero;
3943 if (m_eventsubscription > 0) 3872 UnSubscribeEvents();
3944 UnSubscribeEvents();
3945 return true; 3873 return true;
3946 3874
3947 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/OdeApi.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs
index 2341186..ee48db5 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs
@@ -61,6 +61,8 @@ namespace OdeAPI
61 public static int NTotalBodies = 0; 61 public static int NTotalBodies = 0;
62 public static int NTotalGeoms = 0; 62 public static int NTotalGeoms = 0;
63 63
64 public const uint CONTACTS_UNIMPORTANT = 0x80000000;
65
64 #region Flags and Enumerations 66 #region Flags and Enumerations
65 67
66 [Flags] 68 [Flags]
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 7848b35..2928257 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -713,8 +713,18 @@ namespace OpenSim.Region.Physics.OdePlugin
713 713
714 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 714 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
715 return; 715 return;
716 716 if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
717 count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); 717 d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc)
718 {
719 int cflags;
720 unchecked
721 {
722 cflags = (int)(1 | d.CONTACTS_UNIMPORTANT);
723 }
724 count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf);
725 }
726 else
727 count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf);
718 } 728 }
719 catch (SEHException) 729 catch (SEHException)
720 { 730 {
@@ -1161,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1161 OdePrim cp1; 1171 OdePrim cp1;
1162 OdeCharacter cc2; 1172 OdeCharacter cc2;
1163 OdePrim cp2; 1173 OdePrim cp2;
1174 OdePrim cp1Parent;
1175 OdePrim cp2Parent;
1164 1176
1165 uint obj2LocalID = 0; 1177 uint obj2LocalID = 0;
1166 bool p1events = p1.SubscribedEvents(); 1178 bool p1events = p1.SubscribedEvents();
@@ -1197,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1197 { 1209 {
1198 case ActorTypes.Agent: 1210 case ActorTypes.Agent:
1199 cc2 = (OdeCharacter)p2; 1211 cc2 = (OdeCharacter)p2;
1200 obj2LocalID = cc2.m_localID; 1212 obj2LocalID = cc2.LocalID;
1201 if (p2events) 1213 if (p2events)
1202 cc2.AddCollisionEvent(cc1.m_localID, contact); 1214 cc2.AddCollisionEvent(cc1.LocalID, contact);
1203 break; 1215 break;
1204 1216
1205 case ActorTypes.Prim: 1217 case ActorTypes.Prim:
1206 if (p2 is OdePrim) 1218 if (p2 is OdePrim)
1207 { 1219 {
1208 cp2 = (OdePrim)p2; 1220 cp2 = (OdePrim)p2;
1209 obj2LocalID = cp2.m_localID;
1210 if (p2events) 1221 if (p2events)
1211 cp2.AddCollisionEvent(cc1.m_localID, contact); 1222 cp2.AddCollisionEvent(cc1.LocalID, contact);
1223 cp2 = cp2.Parent;
1224 obj2LocalID = cp2.LocalID;
1212 } 1225 }
1213 break; 1226 break;
1214 1227
@@ -1230,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1230 if (p1 is OdePrim) 1243 if (p1 is OdePrim)
1231 { 1244 {
1232 cp1 = (OdePrim)p1; 1245 cp1 = (OdePrim)p1;
1233 1246 cp1Parent = cp1.Parent;
1234 // obj1LocalID = cp2.m_localID;
1235 switch ((ActorTypes)p2.PhysicsActorType) 1247 switch ((ActorTypes)p2.PhysicsActorType)
1236 { 1248 {
1237 case ActorTypes.Agent: 1249 case ActorTypes.Agent:
1238 if (p2 is OdeCharacter) 1250 if (p2 is OdeCharacter)
1239 { 1251 {
1240 cc2 = (OdeCharacter)p2; 1252 cc2 = (OdeCharacter)p2;
1241 obj2LocalID = cc2.m_localID; 1253 obj2LocalID = cc2.LocalID;
1242 if (p2events) 1254 if (p2events)
1243 cc2.AddCollisionEvent(cp1.m_localID, contact); 1255 cc2.AddCollisionEvent(cp1Parent.LocalID, contact);
1244 } 1256 }
1245 break; 1257 break;
1246 case ActorTypes.Prim: 1258 case ActorTypes.Prim:
@@ -1248,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1248 if (p2 is OdePrim) 1260 if (p2 is OdePrim)
1249 { 1261 {
1250 cp2 = (OdePrim)p2; 1262 cp2 = (OdePrim)p2;
1251 obj2LocalID = cp2.m_localID;
1252 if (p2events) 1263 if (p2events)
1253 cp2.AddCollisionEvent(cp1.m_localID, contact); 1264 cp2.AddCollisionEvent(cp1Parent.LocalID, contact);
1265 cp2 = cp2.Parent;
1266 obj2LocalID = cp2.LocalID;
1254 } 1267 }
1255 break; 1268 break;
1256 1269
@@ -1276,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1276 if (p2 is OdeCharacter) 1289 if (p2 is OdeCharacter)
1277 { 1290 {
1278 cc2 = (OdeCharacter)p2; 1291 cc2 = (OdeCharacter)p2;
1279 obj2LocalID = cc2.m_localID; 1292 obj2LocalID = cc2.LocalID;
1280 if (p2events) 1293 if (p2events)
1281 cc2.AddCollisionEvent(0, contact); 1294 cc2.AddCollisionEvent(0, contact);
1282 } 1295 }
@@ -1285,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1285 if (p2 is OdePrim) 1298 if (p2 is OdePrim)
1286 { 1299 {
1287 cp2 = (OdePrim)p2; 1300 cp2 = (OdePrim)p2;
1288 obj2LocalID = cp2.m_localID; 1301 obj2LocalID = cp2.LocalID;
1289 if (p2events) 1302 if (p2events)
1290 cp2.AddCollisionEvent(0, contact); 1303 cp2.AddCollisionEvent(0, contact);
1291 } 1304 }
@@ -1340,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1340 { 1353 {
1341 foreach (OdePrim prm in _activegroups) 1354 foreach (OdePrim prm in _activegroups)
1342 { 1355 {
1343 if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) 1356 if (!prm.m_outbounds)
1344 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 }
1345 } 1361 }
1346 } 1362 }
1347 catch (AccessViolationException) 1363 catch (AccessViolationException)
@@ -1594,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1594 //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); 1610 //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
1595 lock (prim) 1611 lock (prim)
1596 { 1612 {
1597 RemoveCollisionEventReporting(prim); 1613// RemoveCollisionEventReporting(prim);
1598 lock (_prims) 1614 lock (_prims)
1599 _prims.Remove(prim); 1615 _prims.Remove(prim);
1600 } 1616 }
@@ -2002,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2002 case ActorTypes.Prim: 2018 case ActorTypes.Prim:
2003 OdePrim pobj = (OdePrim)obj; 2019 OdePrim pobj = (OdePrim)obj;
2004 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)
2005 { 2022 {
2006 pobj.AddCollisionFrameTime((int)(odetimestepMS)); 2023 pobj.AddCollisionFrameTime((int)(odetimestepMS));
2007 pobj.SendCollisions(); 2024 pobj.SendCollisions();
@@ -2718,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2718 WaterMapHandler.Free(); 2735 WaterMapHandler.Free();
2719 } 2736 }
2720 2737
2721
2722 if (ContactgeomsArray != IntPtr.Zero) 2738 if (ContactgeomsArray != IntPtr.Zero)
2723 Marshal.FreeHGlobal(ContactgeomsArray); 2739 Marshal.FreeHGlobal(ContactgeomsArray);
2724 if (GlobalContactsArray != IntPtr.Zero) 2740 if (GlobalContactsArray != IntPtr.Zero)
@@ -2741,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2741 { 2757 {
2742 if (prm.CollisionScore > 0) 2758 if (prm.CollisionScore > 0)
2743 { 2759 {
2744 returncolliders.Add(prm.m_localID, prm.CollisionScore); 2760 returncolliders.Add(prm.LocalID, prm.CollisionScore);
2745 cnt++; 2761 cnt++;
2746 prm.CollisionScore = 0f; 2762 prm.CollisionScore = 0f;
2747 if (cnt > 25) 2763 if (cnt > 25)