public override void AddRigidBody(RigidBody body) { if (!body.IsStaticOrKinematicObject() && 0 == (body.GetFlags() & RigidBodyFlags.BT_DISABLE_WORLD_GRAVITY)) body.Gravity = m_gravity; if (body.GetCollisionShape() != null) { if (!body.IsStaticObject()) { m_nonStaticRigidBodies.Add(body); } else { body.SetActivationState(ActivationState.ISLAND_SLEEPING); } bool isDynamic = !(body.IsStaticObject() || body.IsKinematicObject()); CollisionFilterGroups collisionFilterGroup = isDynamic ? CollisionFilterGroups.DefaultFilter : CollisionFilterGroups.StaticFilter; CollisionFilterGroups collisionFilterMask = isDynamic ? CollisionFilterGroups.AllFilter : (CollisionFilterGroups.AllFilter ^ CollisionFilterGroups.StaticFilter); AddCollisionObject(body, collisionFilterGroup, collisionFilterMask); } }
public virtual void AddRigidBody(RigidBody body, CollisionFilterGroups group, CollisionFilterGroups mask) { if (!body.IsStaticOrKinematicObject() && 0 == (body.GetFlags() & RigidBodyFlags.BT_DISABLE_WORLD_GRAVITY)) body.Gravity = m_gravity; if (body.GetCollisionShape() != null) { if (!body.IsStaticObject()) { m_nonStaticRigidBodies.Add(body); } else { body.SetActivationState(ActivationState.ISLAND_SLEEPING); } AddCollisionObject(body, group, mask); } }
public override void AddRigidBody(RigidBody body) { body.Gravity = m_gravity; if (body.GetCollisionShape() != null) { AddCollisionObject(body); } }