From eac5d4015d8f76d883cfa0c19fc66633de5032dc Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 16 Apr 2009 07:31:48 +0000 Subject: * Committing more BulletDotNETPlugin work * Tweak the LLSetStatus results in the ODEPlugin. Hopefully it's a little less unstable. * ODEPlugin is using experimental math for LLSetStatus, use with caution! :) --- .../Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | 4 +++- .../BulletDotNETPlugin/BulletDotNETScene.cs | 26 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletDotNETPlugin') 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 } else { - Body.setCollisionFlags(0); + Body.setCollisionFlags(0 | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK); enableBodySoft(); } m_isSelected = m_taintselected; @@ -2140,6 +2140,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin ((btGImpactMeshShape) prim_geom).setLocalScaling(new btVector3(1, 1, 1)); ((btGImpactMeshShape) prim_geom).updateBound(); } + Body.setCollisionFlags(Body.getCollisionFlags() | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK); + Body.setUserPointer((IntPtr) m_localID); _parent_scene.AddPrimToScene(this); } 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 private readonly btVector3 worldAabbMax = new btVector3((int)Constants.RegionSize + 10f, (int)Constants.RegionSize + 10f, 9000); public IMesher mesher; + private ContactAddedCallbackHandler m_CollisionInterface; public BulletDotNETScene(string sceneIdentifier) { @@ -112,6 +113,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin TransZero = new btTransform(QuatIdentity, VectorZero); m_gravity = new btVector3(0, 0, gravityz); _origheightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; + } public override void Initialise(IMesher meshmerizer, IConfigSource config) @@ -132,6 +134,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); m_world = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration); m_world.setGravity(m_gravity); + EnableCollisionInterface(); + + } public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) @@ -289,7 +294,19 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin */ prm.UpdatePositionAndVelocity(); } + if (m_CollisionInterface != null) + { + List collisions = m_CollisionInterface.GetContactList(); + lock (collisions) + { + foreach (int pvalue in collisions) + { + System.Console.Write(string.Format("{0} ", pvalue)); + } + } + m_CollisionInterface.Clear(); + } return steps; } @@ -675,5 +692,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin } } } + internal void EnableCollisionInterface() + { + if (m_CollisionInterface == null) + { + m_CollisionInterface = new ContactAddedCallbackHandler(); + m_world.SetCollisionAddedCallback(m_CollisionInterface); + } + } + } } -- cgit v1.1