From 3c097cb7a9634f711fffb56c0a6912487694aa53 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 6 Sep 2012 08:05:53 -0700 Subject: BulletSim: Add some comments (gasp) and log messages. --- OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs | 4 ++++ OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 4 ++-- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 5 +++++ OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs index d9270d1..2e15ced 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs @@ -98,6 +98,10 @@ public abstract class BSConstraint : IDisposable { // m_world.scene.PhysicsLogging.Write("{0},BSConstraint.RecomputeConstraintVariables,taint,enabling,A={1},B={2}", // BSScene.DetailLogZero, Body1.ID, Body2.ID); + + // Setting an object's mass to zero (making it static like when it's selected) + // automatically disables the constraints. + // If enabled, be sure to set the constraint itself to enabled. BulletSimAPI.SetConstraintEnable2(m_constraint.Ptr, m_world.scene.NumericBool(true)); } else diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index b04e1b6..3111258 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs @@ -245,8 +245,8 @@ public class BSLinkset // their constraints have not been created yet. // Caused by the fact that m_children is built at run time but building constraints // happens at taint time. - // m_physicsScene.Logger.ErrorFormat("[BULLETSIM LINKSET] RecomputeLinksetConstraintVariables: constraint not found for root={0}, child={1}", - // m_linksetRoot.Body.ID, child.Body.ID); + // m_physicsScene.Logger.ErrorFormat("{0} RecomputeLinksetConstraintVariables: constraint not found for root={1}, child={2}", + // LogHeader, m_linksetRoot.Body.ID, child.Body.ID); } } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index de182f8..01f231b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -472,6 +472,10 @@ public sealed class BSPrim : BSPhysObject // Make gravity work if the object is physical and not selected // No locking here because only called when it is safe + // There are three flags we're interested in: + // IsStatic: Object does not move, otherwise the object has mass and moves + // isSolid: other objects bounce off of this object + // collisionEvents: whether this object returns collision events private void SetObjectDynamic() { // If it's becoming dynamic, it will need hullness @@ -481,6 +485,7 @@ public sealed class BSPrim : BSPhysObject float mass = IsStatic ? 0f : _mass; BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); + m_currentCollisionFlags = BulletSimAPI.GetCollisionFlags2(Body.Ptr); // recompute any linkset parameters Linkset.Refresh(this); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index ab45f8f..4285073 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs @@ -408,8 +408,8 @@ public class BSTerrainManager int mapIndex = (int)regionY * (int)mapInfo.sizeY + (int)regionX; ret = mapInfo.heightMap[mapIndex]; m_terrainModified = false; - DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXY,bX={1},baseY={2},szX={3},szY={4},regX={5},regY={6},index={7},ht={8}", - BSScene.DetailLogZero, offsetX, offsetY, mapInfo.sizeX, mapInfo.sizeY, regionX, regionY, mapIndex, ret); + // DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXY,bX={1},baseY={2},szX={3},szY={4},regX={5},regY={6},index={7},ht={8}", + // BSScene.DetailLogZero, offsetX, offsetY, mapInfo.sizeX, mapInfo.sizeY, regionX, regionY, mapIndex, ret); } else { -- cgit v1.1