aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-07-12 20:05:00 +0100
committerUbitUmarov2012-07-12 20:05:00 +0100
commit4c2523b1c2dd518cc21baf7674775fa2e11e1ca9 (patch)
tree48f58979253066b6a4f201afc7775283d871f1e3 /OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
parentRevert "Add instrumentation to log finalizer being called. Suppressed for bac... (diff)
downloadopensim-SC-4c2523b1c2dd518cc21baf7674775fa2e11e1ca9.zip
opensim-SC-4c2523b1c2dd518cc21baf7674775fa2e11e1ca9.tar.gz
opensim-SC-4c2523b1c2dd518cc21baf7674775fa2e11e1ca9.tar.bz2
opensim-SC-4c2523b1c2dd518cc21baf7674775fa2e11e1ca9.tar.xz
Use faster any contact point collision detection for Volumedetect, plus
some clean up
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs123
1 files changed, 27 insertions, 96 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index ff17a6e..8d5f269 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Physics.OdePlugin
134 134
135// private bool m_collidesLand = true; 135// private bool m_collidesLand = true;
136 private bool m_collidesWater; 136 private bool m_collidesWater;
137 public bool m_returnCollisions; 137// public bool m_returnCollisions;
138 138
139 private bool m_NoColide; // for now only for internal use for bad meshs 139 private bool m_NoColide; // for now only for internal use for bad meshs
140 140
@@ -164,8 +164,8 @@ namespace OpenSim.Region.Physics.OdePlugin
164 private List<OdePrim> childrenPrim = new List<OdePrim>(); 164 private List<OdePrim> childrenPrim = new List<OdePrim>();
165 165
166 166
167 private bool m_throttleUpdates; 167// private bool m_throttleUpdates;
168 private int throttleCounter; 168// private int throttleCounter;
169 public float m_collisionscore; 169 public float m_collisionscore;
170 int m_colliderfilter = 0; 170 int m_colliderfilter = 0;
171 171
@@ -363,12 +363,14 @@ namespace OpenSim.Region.Physics.OdePlugin
363 set { return; } 363 set { return; }
364 } 364 }
365 365
366 public override bool ThrottleUpdates 366
367 public override bool ThrottleUpdates {get;set;}
368/*
367 { 369 {
368 get { return m_throttleUpdates; } 370 get { return m_throttleUpdates; }
369 set { m_throttleUpdates = value; } 371 set { m_throttleUpdates = value; }
370 } 372 }
371 373*/
372 public override bool Stopped 374 public override bool Stopped
373 { 375 {
374 get { return _zeroFlag; } 376 get { return _zeroFlag; }
@@ -951,7 +953,8 @@ namespace OpenSim.Region.Physics.OdePlugin
951 { 953 {
952 if (CollisionEventsThisFrame == null) 954 if (CollisionEventsThisFrame == null)
953 CollisionEventsThisFrame = new CollisionEventUpdate(); 955 CollisionEventsThisFrame = new CollisionEventUpdate();
954 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 956// if(CollisionEventsThisFrame.Count < 32)
957 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
955 } 958 }
956 959
957 public void SendCollisions() 960 public void SendCollisions()
@@ -977,6 +980,10 @@ namespace OpenSim.Region.Physics.OdePlugin
977 } 980 }
978 else 981 else
979 { 982 {
983 if (ncolisions > 10)
984 {
985 }
986
980 SentEmptyCollisionsEvent = false; 987 SentEmptyCollisionsEvent = false;
981 CollisionEventsThisFrame.Clear(); 988 CollisionEventsThisFrame.Clear();
982 } 989 }
@@ -1746,8 +1753,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1746 if (childrenPrim.Count == 0) 1753 if (childrenPrim.Count == 0)
1747 { 1754 {
1748 collide_geom = prim_geom; 1755 collide_geom = prim_geom;
1749 m_targetSpace = _parent_scene.ActiveSpace; 1756 m_targetSpace = _parent_scene.ActiveSpace;
1750 d.SpaceAdd(m_targetSpace, prim_geom);
1751 } 1757 }
1752 else 1758 else
1753 { 1759 {
@@ -1755,7 +1761,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1755 d.HashSpaceSetLevels(m_targetSpace, -2, 8); 1761 d.HashSpaceSetLevels(m_targetSpace, -2, 8);
1756 d.SpaceSetSublevel(m_targetSpace, 3); 1762 d.SpaceSetSublevel(m_targetSpace, 3);
1757 d.SpaceSetCleanup(m_targetSpace, false); 1763 d.SpaceSetCleanup(m_targetSpace, false);
1758 d.SpaceAdd(m_targetSpace, prim_geom);
1759 1764
1760 d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | 1765 d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space |
1761 CollisionCategories.Geom | 1766 CollisionCategories.Geom |
@@ -1766,12 +1771,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1766 collide_geom = m_targetSpace; 1771 collide_geom = m_targetSpace;
1767 } 1772 }
1768 1773
1774 d.SpaceAdd(m_targetSpace, prim_geom);
1775
1769 if (m_delaySelect) 1776 if (m_delaySelect)
1770 { 1777 {
1771 m_isSelected = true; 1778 m_isSelected = true;
1772 m_delaySelect = false; 1779 m_delaySelect = false;
1773 } 1780 }
1774 1781
1782 m_collisionscore = 0;
1783
1784 UpdateCollisionCatFlags();
1785 ApplyCollisionCatFlags();
1786
1787 _parent_scene.addActivePrim(this);
1788
1775 lock (childrenPrim) 1789 lock (childrenPrim)
1776 { 1790 {
1777 foreach (OdePrim prm in childrenPrim) 1791 foreach (OdePrim prm in childrenPrim)
@@ -1809,10 +1823,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1809 createAMotor(m_angularlock); 1823 createAMotor(m_angularlock);
1810 } 1824 }
1811 1825
1812 m_collisionscore = 0;
1813
1814 UpdateCollisionCatFlags();
1815 ApplyCollisionCatFlags();
1816 1826
1817 if (m_isSelected || m_disabled) 1827 if (m_isSelected || m_disabled)
1818 { 1828 {
@@ -1824,7 +1834,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1824 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); 1834 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
1825 } 1835 }
1826 1836
1827 _parent_scene.addActivePrim(this);
1828 _parent_scene.addActiveGroups(this); 1837 _parent_scene.addActiveGroups(this);
1829 } 1838 }
1830 1839
@@ -3441,92 +3450,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3441 if (++bodydisablecontrol < 20) 3450 if (++bodydisablecontrol < 20)
3442 return; 3451 return;
3443 3452
3444 bodydisablecontrol = 0; 3453
3445 d.BodyEnable(Body); 3454 d.BodyEnable(Body);
3446 } 3455 }
3447 3456
3448 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator 3457 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 3458
3507 if (m_outbounds) 3459 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
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
3517 dtmp = d.BodyGetLinearVel(Body);
3518 _velocity.X = dtmp.X;
3519 _velocity.Y = dtmp.Y;
3520 _velocity.Z = dtmp.Z;
3521 3460
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) 3461 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
3531 { 3462 {
3532 // 'VEHICLES' are dealt with in ODEDynamics.cs 3463 // 'VEHICLES' are dealt with in ODEDynamics.cs
@@ -3721,7 +3652,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3721 3652
3722 base.RequestPhysicsterseUpdate(); 3653 base.RequestPhysicsterseUpdate();
3723 3654
3724 throttleCounter = 0; 3655// throttleCounter = 0;
3725 _zeroFlag = true; 3656 _zeroFlag = true;
3726 3657
3727 disableBodySoft(); // disable it and colisions 3658 disableBodySoft(); // disable it and colisions