diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | 57 |
1 files changed, 16 insertions, 41 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 30a7bee..0c7f315 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | |||
@@ -232,21 +232,25 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
232 | 232 | ||
233 | public override bool AddObjectToWorld(BulletWorld pWorld, BulletBody pBody) | 233 | public override bool AddObjectToWorld(BulletWorld pWorld, BulletBody pBody) |
234 | { | 234 | { |
235 | DiscreteDynamicsWorld world = ((BulletWorldXNA)pWorld).world; | ||
236 | CollisionObject cbody = ((BulletBodyXNA)pBody).body; | ||
237 | RigidBody rbody = cbody as RigidBody; | ||
238 | |||
235 | // Bullet resets several variables when an object is added to the world. In particular, | 239 | // Bullet resets several variables when an object is added to the world. In particular, |
236 | // BulletXNA resets position and rotation. Gravity is also reset depending on the static/dynamic | 240 | // BulletXNA resets position and rotation. Gravity is also reset depending on the static/dynamic |
237 | // type. Of course, the collision flags in the broadphase proxy are initialized to default. | 241 | // type. Of course, the collision flags in the broadphase proxy are initialized to default. |
238 | DiscreteDynamicsWorld world = ((BulletWorldXNA)pWorld).world; | 242 | IndexedMatrix origPos = cbody.GetWorldTransform(); |
239 | RigidBody body = ((BulletBodyXNA)pBody).rigidBody; | 243 | if (rbody != null) |
240 | 244 | { | |
241 | IndexedMatrix origPos = body.GetWorldTransform(); | 245 | IndexedVector3 origGrav = rbody.GetGravity(); |
242 | IndexedVector3 origGrav = body.GetGravity(); | 246 | world.AddRigidBody(rbody); |
243 | 247 | rbody.SetGravity(origGrav); | |
244 | //if (!(body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.STATIC_PLANE_PROXYTYPE && body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.TERRAIN_SHAPE_PROXYTYPE)) | 248 | } |
245 | 249 | else | |
246 | world.AddRigidBody(body); | 250 | { |
247 | 251 | world.AddCollisionObject(rbody); | |
248 | body.SetWorldTransform(origPos); | 252 | } |
249 | body.SetGravity(origGrav); | 253 | cbody.SetWorldTransform(origPos); |
250 | 254 | ||
251 | pBody.ApplyCollisionMask(pWorld.physicsScene); | 255 | pBody.ApplyCollisionMask(pWorld.physicsScene); |
252 | 256 | ||
@@ -773,35 +777,6 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
773 | body.ApplyTorqueImpulse(ref fSum); | 777 | body.ApplyTorqueImpulse(ref fSum); |
774 | } | 778 | } |
775 | 779 | ||
776 | public override void DumpRigidBody(BulletWorld p, BulletBody p_2) | ||
777 | { | ||
778 | //TODO: | ||
779 | } | ||
780 | |||
781 | public override void DumpCollisionShape(BulletWorld p, BulletShape p_2) | ||
782 | { | ||
783 | //TODO: | ||
784 | } | ||
785 | public override void DumpConstraint(BulletWorld world, BulletConstraint constrain) | ||
786 | { | ||
787 | //TODO: | ||
788 | } | ||
789 | |||
790 | public override void DumpActivationInfo(BulletWorld world) | ||
791 | { | ||
792 | //TODO: | ||
793 | } | ||
794 | |||
795 | public override void DumpAllInfo(BulletWorld world) | ||
796 | { | ||
797 | //TODO: | ||
798 | } | ||
799 | |||
800 | public override void DumpPhysicsStatistics(BulletWorld world) | ||
801 | { | ||
802 | //TODO: | ||
803 | } | ||
804 | |||
805 | public override void DestroyObject(BulletWorld p, BulletBody p_2) | 780 | public override void DestroyObject(BulletWorld p, BulletBody p_2) |
806 | { | 781 | { |
807 | //TODO: | 782 | //TODO: |