aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-27 22:02:38 -0800
committerRobert Adams2012-12-27 22:12:28 -0800
commit422f0fd6ec6e30c5200dbf81875c64223002f9c7 (patch)
treee5c5fb143fa849805472f7a6025fb4a89fc01c5c /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: Parameterize nominal frame rate (55) and add parameters to dynamia... (diff)
downloadopensim-SC_OLD-422f0fd6ec6e30c5200dbf81875c64223002f9c7.zip
opensim-SC_OLD-422f0fd6ec6e30c5200dbf81875c64223002f9c7.tar.gz
opensim-SC_OLD-422f0fd6ec6e30c5200dbf81875c64223002f9c7.tar.bz2
opensim-SC_OLD-422f0fd6ec6e30c5200dbf81875c64223002f9c7.tar.xz
BulletSim: fix physical object not interacting with static objects.
Another instance of the underlying Bullet doing, ah, helpful things when items are added to the world.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs33
1 files changed, 24 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 2d429c4..5f3f0d1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -438,7 +438,7 @@ public sealed class BSPrim : BSPhysObject
438 438
439 if (inWorld) 439 if (inWorld)
440 { 440 {
441 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 441 AddObjectToPhysicalWorld();
442 } 442 }
443 443
444 // Must set gravity after it has been added to the world because, for unknown reasons, 444 // Must set gravity after it has been added to the world because, for unknown reasons,
@@ -740,18 +740,11 @@ public sealed class BSPrim : BSPhysObject
740 // Make solid or not (do things bounce off or pass through this object). 740 // Make solid or not (do things bounce off or pass through this object).
741 MakeSolid(IsSolid); 741 MakeSolid(IsSolid);
742 742
743 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 743 AddObjectToPhysicalWorld();
744
745 // TODO: Fix this. Total kludge because adding object to world resets its gravity to default.
746 // Replace this when the new AddObjectToWorld function is complete.
747 BulletSimAPI.SetGravity2(PhysBody.ptr, ComputeGravity());
748 744
749 // Rebuild its shape 745 // Rebuild its shape
750 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 746 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
751 747
752 // Collision filter can be set only when the object is in the world
753 PhysBody.ApplyCollisionMask();
754
755 // Recompute any linkset parameters. 748 // Recompute any linkset parameters.
756 // When going from non-physical to physical, this re-enables the constraints that 749 // When going from non-physical to physical, this re-enables the constraints that
757 // had been automatically disabled when the mass was set to zero. 750 // had been automatically disabled when the mass was set to zero.
@@ -900,6 +893,28 @@ public sealed class BSPrim : BSPhysObject
900 } 893 }
901 } 894 }
902 895
896 // Add me to the physical world.
897 // Object MUST NOT already be in the world.
898 // This routine exists because some assorted properties get mangled by adding to the world.
899 internal void AddObjectToPhysicalWorld()
900 {
901 if (PhysBody.HasPhysicalBody)
902 {
903 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
904
905 // TODO: Fix this. Total kludge because adding object to world resets its gravity to default.
906 // Replace this when the new AddObjectToWorld function is complete.
907 BulletSimAPI.SetGravity2(PhysBody.ptr, ComputeGravity());
908
909 // Collision filter can be set only when the object is in the world
910 if (!PhysBody.ApplyCollisionMask())
911 {
912 m_log.ErrorFormat("{0} Failed setting object collision mask: id={1}", LogHeader, LocalID);
913 DetailLog("{0},BSPrim.UpdatePhysicalParameters,failedSetMaskGroup,cType={1}", LocalID, PhysBody.collisionType);
914 }
915 }
916 }
917
903 // prims don't fly 918 // prims don't fly
904 public override bool Flying { 919 public override bool Flying {
905 get { return _flying; } 920 get { return _flying; }