Exemplo n.º 1
0
        public override void AddRigidBody(RigidBody body)
        {
            if (!body.IsStaticOrKinematicObject() && 0 == (body.GetFlags() & RigidBodyFlags.BT_DISABLE_WORLD_GRAVITY))
            {
                body.SetGravity(ref 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);
            }
        }
Exemplo n.º 2
0
        public override void AddRigidBody(RigidBody body, CollisionFilterGroups group, CollisionFilterGroups mask)
        {
            body.SetGravity(ref m_gravity);

            if (body.GetCollisionShape() != null)
            {
                AddCollisionObject(body, group, mask);
            }
        }
Exemplo n.º 3
0
        public override void AddRigidBody(RigidBody body)
        {
            body.SetGravity(ref m_gravity);

            if (body.GetCollisionShape() != null)
            {
                AddCollisionObject(body);
            }
        }
Exemplo n.º 4
0
 public override void SetGravity(ref IndexedVector3 gravity)
 {
     m_gravity = gravity;
     foreach (CollisionObject colObj in m_collisionObjects)
     {
         RigidBody body = RigidBody.Upcast(colObj);
         if (body != null)
         {
             body.SetGravity(ref gravity);
         }
     }
 }
Exemplo n.º 5
0
        public override void SetGravity(ref IndexedVector3 gravity)
        {
            m_gravity = gravity;
            int length = m_nonStaticRigidBodies.Count;

            for (int i = 0; i < length; ++i)
            {
                RigidBody body = m_nonStaticRigidBodies[i];
                if (body.IsActive() && ((body.GetFlags() & RigidBodyFlags.BT_DISABLE_WORLD_GRAVITY) == 0))
                {
                    body.SetGravity(ref gravity);
                }
            }
        }
Exemplo n.º 6
0
        public override void AddRigidBody(RigidBody body, CollisionFilterGroups group, CollisionFilterGroups mask)
        {
            if (!body.IsStaticOrKinematicObject() && 0 == (body.GetFlags() & RigidBodyFlags.BT_DISABLE_WORLD_GRAVITY))
            {
                body.SetGravity(ref m_gravity);
            }

            if (body.GetCollisionShape() != null)
            {
                if (!body.IsStaticObject())
                {
                    if (!m_nonStaticRigidBodies.Contains(body))
                    {
                        m_nonStaticRigidBodies.Add(body);
                    }
                }
                else
                {
                    body.SetActivationState(ActivationState.ISLAND_SLEEPING);
                }

                AddCollisionObject(body, group, mask);
            }
        }
		public override void AddRigidBody(RigidBody body, CollisionFilterGroups group, CollisionFilterGroups mask)
		{
			body.SetGravity(ref m_gravity);

			if (body.GetCollisionShape() != null)
			{
				AddCollisionObject(body, group, mask);
			}
		}
		public override void AddRigidBody(RigidBody body)
		{
			body.SetGravity(ref m_gravity);

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

		}