aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs22
1 files changed, 17 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 68a153e..17ba85a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -507,6 +507,9 @@ public sealed class BSPrim : BSPhysObject
507 // Set up the object physicalness (does gravity and collisions move this object) 507 // Set up the object physicalness (does gravity and collisions move this object)
508 MakeDynamic(IsStatic); 508 MakeDynamic(IsStatic);
509 509
510 // Do any vehicle stuff
511 _vehicle.Refresh();
512
510 // Arrange for collision events if the simulator wants them 513 // Arrange for collision events if the simulator wants them
511 EnableCollisions(SubscribedEvents()); 514 EnableCollisions(SubscribedEvents());
512 515
@@ -556,9 +559,8 @@ public sealed class BSPrim : BSPhysObject
556 BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); 559 BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr);
557 // There can be special things needed for implementing linksets 560 // There can be special things needed for implementing linksets
558 Linkset.MakeStatic(this); 561 Linkset.MakeStatic(this);
559 // The activation state is 'sleeping' so Bullet will not try to act on it 562 // The activation state is 'disabled' so Bullet will not try to act on it
560 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING); 563 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_SIMULATION);
561 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_SIMULATION);
562 564
563 BSBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter; 565 BSBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter;
564 BSBody.collisionMask = CollisionFilterGroups.StaticObjectMask; 566 BSBody.collisionMask = CollisionFilterGroups.StaticObjectMask;
@@ -577,7 +579,8 @@ public sealed class BSPrim : BSPhysObject
577 579
578 // A dynamic object has mass 580 // A dynamic object has mass
579 IntPtr collisionShapePtr = BulletSimAPI.GetCollisionShape2(BSBody.ptr); 581 IntPtr collisionShapePtr = BulletSimAPI.GetCollisionShape2(BSBody.ptr);
580 OMV.Vector3 inertia = BulletSimAPI.CalculateLocalInertia2(collisionShapePtr, Linkset.LinksetMass); 582 OMV.Vector3 inertia = BulletSimAPI.CalculateLocalInertia2(collisionShapePtr, Mass);
583 // OMV.Vector3 inertia = OMV.Vector3.Zero;
581 BulletSimAPI.SetMassProps2(BSBody.ptr, _mass, inertia); 584 BulletSimAPI.SetMassProps2(BSBody.ptr, _mass, inertia);
582 BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); 585 BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr);
583 586
@@ -587,10 +590,12 @@ public sealed class BSPrim : BSPhysObject
587 BulletSimAPI.SetSleepingThresholds2(BSBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); 590 BulletSimAPI.SetSleepingThresholds2(BSBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold);
588 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 591 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
589 592
590 // There can be special things needed for implementing linksets 593 // There can be special things needed for implementing linksets.
591 Linkset.MakeDynamic(this); 594 Linkset.MakeDynamic(this);
592 595
593 // Force activation of the object so Bullet will act on it. 596 // Force activation of the object so Bullet will act on it.
597 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects.
598 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING);
594 BulletSimAPI.Activate2(BSBody.ptr, true); 599 BulletSimAPI.Activate2(BSBody.ptr, true);
595 600
596 BSBody.collisionFilter = CollisionFilterGroups.ObjectFilter; 601 BSBody.collisionFilter = CollisionFilterGroups.ObjectFilter;
@@ -1457,9 +1462,16 @@ public sealed class BSPrim : BSPhysObject
1457 ShapeData shapeData; 1462 ShapeData shapeData;
1458 FillShapeInfo(out shapeData); 1463 FillShapeInfo(out shapeData);
1459 1464
1465 // Undo me from any possible linkset so, if body is rebuilt, the link will get restored.
1466 // NOTE that the new linkset is not set. This saves the handle to the linkset
1467 // so we can add ourselves back when shape mangling is complete.
1468 Linkset.RemoveMeFromLinkset(this);
1469
1460 // Create the correct physical representation for this type of object. 1470 // Create the correct physical representation for this type of object.
1461 // Updates BSBody and BSShape with the new information. 1471 // Updates BSBody and BSShape with the new information.
1462 PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs); 1472 PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs);
1473
1474 Linkset = Linkset.AddMeToLinkset(this);
1463 1475
1464 // Make sure the properties are set on the new object 1476 // Make sure the properties are set on the new object
1465 UpdatePhysicalParameters(); 1477 UpdatePhysicalParameters();