aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index c4f659c..fecd4a1 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
103 private readonly btVector3 worldAabbMax = new btVector3((int)Constants.RegionSize + 10f, (int)Constants.RegionSize + 10f, 9000); 103 private readonly btVector3 worldAabbMax = new btVector3((int)Constants.RegionSize + 10f, (int)Constants.RegionSize + 10f, 9000);
104 104
105 public IMesher mesher; 105 public IMesher mesher;
106 private ContactAddedCallbackHandler m_CollisionInterface;
106 107
107 public BulletDotNETScene(string sceneIdentifier) 108 public BulletDotNETScene(string sceneIdentifier)
108 { 109 {
@@ -112,6 +113,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
112 TransZero = new btTransform(QuatIdentity, VectorZero); 113 TransZero = new btTransform(QuatIdentity, VectorZero);
113 m_gravity = new btVector3(0, 0, gravityz); 114 m_gravity = new btVector3(0, 0, gravityz);
114 _origheightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; 115 _origheightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
116
115 } 117 }
116 118
117 public override void Initialise(IMesher meshmerizer, IConfigSource config) 119 public override void Initialise(IMesher meshmerizer, IConfigSource config)
@@ -132,6 +134,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
132 m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); 134 m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
133 m_world = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration); 135 m_world = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration);
134 m_world.setGravity(m_gravity); 136 m_world.setGravity(m_gravity);
137 EnableCollisionInterface();
138
139
135 } 140 }
136 141
137 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 142 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
@@ -289,7 +294,19 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
289 */ 294 */
290 prm.UpdatePositionAndVelocity(); 295 prm.UpdatePositionAndVelocity();
291 } 296 }
297 if (m_CollisionInterface != null)
298 {
299 List<int> collisions = m_CollisionInterface.GetContactList();
300 lock (collisions)
301 {
302 foreach (int pvalue in collisions)
303 {
304 System.Console.Write(string.Format("{0} ", pvalue));
305 }
306 }
307 m_CollisionInterface.Clear();
292 308
309 }
293 return steps; 310 return steps;
294 } 311 }
295 312
@@ -675,5 +692,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
675 } 692 }
676 } 693 }
677 } 694 }
695 internal void EnableCollisionInterface()
696 {
697 if (m_CollisionInterface == null)
698 {
699 m_CollisionInterface = new ContactAddedCallbackHandler();
700 m_world.SetCollisionAddedCallback(m_CollisionInterface);
701 }
702 }
703
678 } 704 }
679} 705}