aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs48
1 files changed, 40 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 5cdbb77..a063962 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.Physics.OdePlugin
55 private bool m_taintPhysics = false; 55 private bool m_taintPhysics = false;
56 public bool m_taintremove = false; 56 public bool m_taintremove = false;
57 public bool m_taintdisable = false; 57 public bool m_taintdisable = false;
58 public bool m_disabled = false;
58 59
59 private bool m_taintforce = false; 60 private bool m_taintforce = false;
60 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); 61 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
@@ -65,10 +66,15 @@ namespace OpenSim.Region.Physics.OdePlugin
65 public IntPtr m_targetSpace = (IntPtr) 0; 66 public IntPtr m_targetSpace = (IntPtr) 0;
66 public IntPtr prim_geom; 67 public IntPtr prim_geom;
67 public IntPtr _triMeshData; 68 public IntPtr _triMeshData;
69
68 private bool iscolliding = false; 70 private bool iscolliding = false;
69 private bool m_isphysical = false; 71 private bool m_isphysical = false;
70 private bool m_throttleUpdates = false; 72 private bool m_throttleUpdates = false;
71 private int throttleCounter = 0; 73 private int throttleCounter = 0;
74 public int m_interpenetrationcount = 0;
75 public int m_collisionscore = 0;
76 public int m_roundsUnderMotionThreshold = 0;
77
72 public bool outofBounds = false; 78 public bool outofBounds = false;
73 private float m_density = 10.000006836f; // Aluminum g/cm3; 79 private float m_density = 10.000006836f; // Aluminum g/cm3;
74 80
@@ -257,6 +263,10 @@ namespace OpenSim.Region.Physics.OdePlugin
257 d.GeomSetBody(prim_geom, Body); 263 d.GeomSetBody(prim_geom, Body);
258 d.BodySetAutoDisableFlag(Body, true); 264 d.BodySetAutoDisableFlag(Body, true);
259 d.BodySetAutoDisableSteps(Body, 20); 265 d.BodySetAutoDisableSteps(Body, 20);
266
267 m_interpenetrationcount = 0;
268 m_collisionscore = 0;
269 m_disabled = false;
260 270
261 _parent_scene.addActivePrim(this); 271 _parent_scene.addActivePrim(this);
262 } 272 }
@@ -383,6 +393,8 @@ namespace OpenSim.Region.Physics.OdePlugin
383 d.BodyDestroy(Body); 393 d.BodyDestroy(Body);
384 Body = (IntPtr) 0; 394 Body = (IntPtr) 0;
385 } 395 }
396 m_disabled = true;
397 m_collisionscore = 0;
386 } 398 }
387 399
388 public void setMesh(OdeScene parent_scene, IMesh mesh) 400 public void setMesh(OdeScene parent_scene, IMesh mesh)
@@ -425,7 +437,11 @@ namespace OpenSim.Region.Physics.OdePlugin
425 if (IsPhysical && Body == (IntPtr) 0) 437 if (IsPhysical && Body == (IntPtr) 0)
426 { 438 {
427 // Recreate the body 439 // Recreate the body
440 m_interpenetrationcount = 0;
441 m_collisionscore = 0;
442
428 enableBody(); 443 enableBody();
444
429 } 445 }
430 } 446 }
431 447
@@ -485,7 +501,7 @@ namespace OpenSim.Region.Physics.OdePlugin
485 _parent_scene.waitForSpaceUnlock(m_targetSpace); 501 _parent_scene.waitForSpaceUnlock(m_targetSpace);
486 d.SpaceAdd(m_targetSpace, prim_geom); 502 d.SpaceAdd(m_targetSpace, prim_geom);
487 } 503 }
488 504 resetCollisionAccounting();
489 m_taintposition = _position; 505 m_taintposition = _position;
490 } 506 }
491 507
@@ -501,14 +517,23 @@ namespace OpenSim.Region.Physics.OdePlugin
501 { 517 {
502 d.BodySetQuaternion(Body, ref myrot); 518 d.BodySetQuaternion(Body, ref myrot);
503 } 519 }
504 520 resetCollisionAccounting();
505 m_taintrot = _orientation; 521 m_taintrot = _orientation;
506 } 522 }
507 public void changedisable(float timestep) 523
524 private void resetCollisionAccounting()
508 { 525 {
526 m_collisionscore = 0;
527 m_interpenetrationcount = 0;
528 m_disabled = false;
529 }
530
531 public void changedisable(float timestep)
532 {
533 m_disabled = true;
509 if (Body != (IntPtr) 0) 534 if (Body != (IntPtr) 0)
510 d.BodyDisable(Body); 535 d.BodyDisable(Body);
511 536
512 m_taintdisable = false; 537 m_taintdisable = false;
513 } 538 }
514 539
@@ -528,8 +553,7 @@ namespace OpenSim.Region.Physics.OdePlugin
528 disableBody(); 553 disableBody();
529 } 554 }
530 } 555 }
531 556 resetCollisionAccounting();
532
533 m_taintPhysics = m_isphysical; 557 m_taintPhysics = m_isphysical;
534 } 558 }
535 559
@@ -670,7 +694,7 @@ namespace OpenSim.Region.Physics.OdePlugin
670 } 694 }
671 695
672 _parent_scene.geom_name_map[prim_geom] = oldname; 696 _parent_scene.geom_name_map[prim_geom] = oldname;
673 697 resetCollisionAccounting();
674 m_taintsize = _size; 698 m_taintsize = _size;
675 } 699 }
676 700
@@ -724,7 +748,7 @@ namespace OpenSim.Region.Physics.OdePlugin
724 d.GeomSetQuaternion(prim_geom, ref myrot); 748 d.GeomSetQuaternion(prim_geom, ref myrot);
725 } 749 }
726 _parent_scene.geom_name_map[prim_geom] = oldname; 750 _parent_scene.geom_name_map[prim_geom] = oldname;
727 751 resetCollisionAccounting();
728 m_taintshape = false; 752 m_taintshape = false;
729 } 753 }
730 754
@@ -746,6 +770,8 @@ namespace OpenSim.Region.Physics.OdePlugin
746 } 770 }
747 m_forcelist.Clear(); 771 m_forcelist.Clear();
748 } 772 }
773 m_collisionscore = 0;
774 m_interpenetrationcount = 0;
749 m_taintforce = false; 775 m_taintforce = false;
750 776
751 } 777 }
@@ -759,6 +785,7 @@ namespace OpenSim.Region.Physics.OdePlugin
759 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); 785 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
760 } 786 }
761 } 787 }
788 resetCollisionAccounting();
762 m_taintVelocity = PhysicsVector.Zero; 789 m_taintVelocity = PhysicsVector.Zero;
763 } 790 }
764 public override bool IsPhysical 791 public override bool IsPhysical
@@ -865,6 +892,11 @@ namespace OpenSim.Region.Physics.OdePlugin
865 } 892 }
866 } 893 }
867 894
895 public override float CollisionScore
896 {
897 get { return m_collisionscore; }
898 }
899
868 public override bool Kinematic 900 public override bool Kinematic
869 { 901 {
870 get { return false; } 902 get { return false; }