예제 #1
0
		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);
			}
		}
예제 #2
0
		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);
			}
		}
예제 #3
0
        public override void AddRigidBody(RigidBody body)
        {
            body.Gravity = m_gravity;

            if (body.GetCollisionShape() != null)
            {
                AddCollisionObject(body);
            }

        }