From 1f6aaad0b587f1589afd7a7ca6feb8d2bbba8641 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Dec 2012 22:04:12 -0800 Subject: BulletSim: correct collision mask definition for linkset children. Remove unused code. Add comments and TODOs. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 1 + .../Region/Physics/BulletSPlugin/BulletSimAPI.cs | 24 +++++++++---------- .../Region/Physics/BulletSPlugin/BulletSimData.cs | 27 ++++------------------ .../Region/Physics/BulletSPlugin/BulletSimTODO.txt | 1 + 4 files changed, 18 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 8edcd20..4133107 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -269,6 +269,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters BSParam.SetParameterConfigurationValues(this, pConfig); // Very detailed logging for physics debugging + // TODO: the boolean values can be moved to the normal parameter processing. m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index afe5bca..eb4d039 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs @@ -250,20 +250,20 @@ public enum CollisionFilterGroups : uint // filter/mask definition below. This way collision interactions // are more easily found and debugged. BNoneGroup = 0, - BDefaultGroup = 1 << 0, - BStaticGroup = 1 << 1, - BKinematicGroup = 1 << 2, - BDebrisGroup = 1 << 3, - BSensorTrigger = 1 << 4, - BCharacterGroup = 1 << 5, - BAllGroup = 0xFFFFFFFF, + BDefaultGroup = 1 << 0, // 0001 + BStaticGroup = 1 << 1, // 0002 + BKinematicGroup = 1 << 2, // 0004 + BDebrisGroup = 1 << 3, // 0008 + BSensorTrigger = 1 << 4, // 0010 + BCharacterGroup = 1 << 5, // 0020 + BAllGroup = 0x000FFFFF, // Filter groups defined by BulletSim - BGroundPlaneGroup = 1 << 10, - BTerrainGroup = 1 << 11, - BRaycastGroup = 1 << 12, - BSolidGroup = 1 << 13, + BGroundPlaneGroup = 1 << 10, // 0400 + BTerrainGroup = 1 << 11, // 0800 + BRaycastGroup = 1 << 12, // 1000 + BSolidGroup = 1 << 13, // 2000 // BLinksetGroup = xx // a linkset proper is either static or dynamic - BLinksetChildGroup = 1 << 14, + BLinksetChildGroup = 1 << 14, // 4000 }; // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index 36d38d4..5ad6746 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs @@ -72,12 +72,12 @@ public struct BulletBody public bool HasPhysicalBody { get { return ptr != IntPtr.Zero; } } // Apply the specificed collision mask into the physical world - public void ApplyCollisionMask() + public bool ApplyCollisionMask() { // Should assert the body has been added to the physical world. // (The collision masks are stored in the collision proxy cache which only exists for // a collision body that is in the world.) - BulletSimAPI.SetCollisionGroupMask2(ptr, + return BulletSimAPI.SetCollisionGroupMask2(ptr, BulletSimData.CollisionTypeMasks[collisionType].group, BulletSimData.CollisionTypeMasks[collisionType].mask); } @@ -207,26 +207,6 @@ public struct CollisionTypeFilterGroup public uint mask; }; - /* NOTE: old definitions kept for reference. Delete when things are working. - // The collsion filters and masked are defined in one place -- don't want them scattered - AvatarGroup = BCharacterGroup, - AvatarMask = BAllGroup, - ObjectGroup = BSolidGroup, - ObjectMask = BAllGroup, - StaticObjectGroup = BStaticGroup, - StaticObjectMask = AvatarGroup | ObjectGroup, // static things don't interact with much - LinksetGroup = BLinksetGroup, - LinksetMask = BAllGroup, - LinksetChildGroup = BLinksetChildGroup, - LinksetChildMask = BNoneGroup, // Linkset children disappear from the world - VolumeDetectGroup = BSensorTrigger, - VolumeDetectMask = ~BSensorTrigger, - TerrainGroup = BTerrainGroup, - TerrainMask = BAllGroup & ~BStaticGroup, // static objects on the ground don't collide - GroundPlaneGroup = BGroundPlaneGroup, - GroundPlaneMask = BAllGroup - */ - public static class BulletSimData { @@ -269,8 +249,9 @@ public static Dictionary CollisionTypeM }, { CollisionType.LinksetChild, new CollisionTypeFilterGroup(CollisionType.LinksetChild, - (uint)CollisionFilterGroups.BTerrainGroup, + (uint)CollisionFilterGroups.BLinksetChildGroup, (uint)(CollisionFilterGroups.BNoneGroup)) + // (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) }, }; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 16131cd..f805836 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -194,6 +194,7 @@ Should taints check for existance or activeness of target? actually gone when the taint happens. Crashes don't happen because the taint closure keeps the object from being freed, but that is just an accident. Possibly have and 'active' flag that is checked by the taint processor? +Parameters for physics logging should be moved from BSScene to BSParam (at least boolean ones) THREADING ================================================= -- cgit v1.1