BulletSim: correct collision mask definition for linkset children.

Remove unused code. Add comments and TODOs.
0.7.5-pf-bulletsim
Robert Adams 2012-12-27 22:04:12 -08:00
parent 422f0fd6ec
commit 1f6aaad0b5
4 changed files with 18 additions and 35 deletions

View File

@ -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%-");

View File

@ -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

View File

@ -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<CollisionType, CollisionTypeFilterGroup> CollisionTypeM
},
{ CollisionType.LinksetChild,
new CollisionTypeFilterGroup(CollisionType.LinksetChild,
(uint)CollisionFilterGroups.BTerrainGroup,
(uint)CollisionFilterGroups.BLinksetChildGroup,
(uint)(CollisionFilterGroups.BNoneGroup))
// (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup))
},
};

View File

@ -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
=================================================