diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletDotNETPlugin')
-rw-r--r-- | OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index a2caeac..5ff73c5 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -1289,7 +1289,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1289 | } | 1289 | } |
1290 | else | 1290 | else |
1291 | { | 1291 | { |
1292 | Body.setCollisionFlags(0); | 1292 | Body.setCollisionFlags(0 | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK); |
1293 | enableBodySoft(); | 1293 | enableBodySoft(); |
1294 | } | 1294 | } |
1295 | m_isSelected = m_taintselected; | 1295 | m_isSelected = m_taintselected; |
@@ -2140,6 +2140,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2140 | ((btGImpactMeshShape) prim_geom).setLocalScaling(new btVector3(1, 1, 1)); | 2140 | ((btGImpactMeshShape) prim_geom).setLocalScaling(new btVector3(1, 1, 1)); |
2141 | ((btGImpactMeshShape) prim_geom).updateBound(); | 2141 | ((btGImpactMeshShape) prim_geom).updateBound(); |
2142 | } | 2142 | } |
2143 | Body.setCollisionFlags(Body.getCollisionFlags() | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK); | ||
2144 | Body.setUserPointer((IntPtr) m_localID); | ||
2143 | _parent_scene.AddPrimToScene(this); | 2145 | _parent_scene.AddPrimToScene(this); |
2144 | } | 2146 | } |
2145 | else | 2147 | else |
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 | } |