示例#1
0
		public void addRigidBody( btRigidBody body, btBroadphaseProxy.CollisionFilterGroups group, btBroadphaseProxy.CollisionFilterGroups mask )
		{
			if( !body.isStaticOrKinematicObject() && 0 == ( body.getFlags() & btRigidBodyFlags.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 );
				}
				addCollisionObject( body, group, mask );
			}
		}
示例#2
0
		public void addRigidBody( btRigidBody body )
		{
			if( !body.isStaticOrKinematicObject() && ( body.getFlags() & btRigidBodyFlags.BT_DISABLE_WORLD_GRAVITY ) == 0 )
			{
				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() );
				btBroadphaseProxy.CollisionFilterGroups collisionFilterGroup = ( isDynamic ? btBroadphaseProxy.CollisionFilterGroups.DefaultFilter : btBroadphaseProxy.CollisionFilterGroups.StaticFilter );
				btBroadphaseProxy.CollisionFilterGroups collisionFilterMask = ( isDynamic ? btBroadphaseProxy.CollisionFilterGroups.AllFilter : ( btBroadphaseProxy.CollisionFilterGroups.AllFilter ^ btBroadphaseProxy.CollisionFilterGroups.StaticFilter ) );

				addCollisionObject( body, collisionFilterGroup, collisionFilterMask );
			}
		}