aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs33
1 files changed, 29 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
index 6a54705..ac4e2b9 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
@@ -108,12 +108,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
108 private bool[] m_colliderarr = new bool[11]; 108 private bool[] m_colliderarr = new bool[11];
109 private bool[] m_colliderGroundarr = new bool[11]; 109 private bool[] m_colliderGroundarr = new bool[11];
110 110
111
112
113 private BulletDotNETScene m_parent_scene; 111 private BulletDotNETScene m_parent_scene;
114 112
115 public int m_eventsubscription = 0; 113 public int m_eventsubscription = 0;
116 // private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); 114 private CollisionEventUpdate CollisionEventsThisFrame = null;
115 private int m_requestedUpdateFrequency = 0;
117 116
118 public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) 117 public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
119 { 118 {
@@ -212,7 +211,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
212 m_mass = Mass; 211 m_mass = Mass;
213 212
214 Body = new btRigidBody(m_mass, m_bodyMotionState, Shell); 213 Body = new btRigidBody(m_mass, m_bodyMotionState, Shell);
215 Body.setUserPointer(new IntPtr((int)Body.Handle)); 214 // this is used for self identification. User localID instead of body handle
215 Body.setUserPointer(new IntPtr((int)m_localID));
216 216
217 if (ClosestCastResult != null) 217 if (ClosestCastResult != null)
218 ClosestCastResult.Dispose(); 218 ClosestCastResult.Dispose();
@@ -717,6 +717,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
717 public override void SubscribeEvents(int ms) 717 public override void SubscribeEvents(int ms)
718 { 718 {
719 m_eventsubscription = ms; 719 m_eventsubscription = ms;
720 m_requestedUpdateFrequency = ms;
720 m_parent_scene.addCollisionEventReporting(this); 721 m_parent_scene.addCollisionEventReporting(this);
721 } 722 }
722 723
@@ -724,6 +725,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
724 { 725 {
725 m_parent_scene.remCollisionEventReporting(this); 726 m_parent_scene.remCollisionEventReporting(this);
726 m_eventsubscription = 0; 727 m_eventsubscription = 0;
728 m_requestedUpdateFrequency = 0;
727 } 729 }
728 730
729 public override bool SubscribedEvents() 731 public override bool SubscribedEvents()
@@ -733,6 +735,29 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
733 return false; 735 return false;
734 } 736 }
735 737
738 public void AddCollision(uint collideWith, ContactPoint contact)
739 {
740 if (CollisionEventsThisFrame == null)
741 {
742 CollisionEventsThisFrame = new CollisionEventUpdate();
743 }
744 CollisionEventsThisFrame.addCollider(collideWith, contact);
745 }
746
747 public void SendCollisions()
748 {
749 if (m_eventsubscription >= m_requestedUpdateFrequency)
750 {
751 if (CollisionEventsThisFrame != null)
752 {
753 base.SendCollisionUpdate(CollisionEventsThisFrame);
754 }
755 CollisionEventsThisFrame = new CollisionEventUpdate();
756 m_eventsubscription = 0;
757 }
758 return;
759 }
760
736 internal void Dispose() 761 internal void Dispose()
737 { 762 {
738 if (Body.isInWorld()) 763 if (Body.isInWorld())