Ejemplo n.º 1
0
		public virtual void removeCollisionObject( btCollisionObject collisionObject )
		{


			//bool removeFromBroadphase = false;

			{

				btBroadphaseProxy bp = collisionObject.getBroadphaseHandle();
				if( bp != null )
				{
					//
					// only clear the cached algorithms
					//
					getBroadphase().getOverlappingPairCache().cleanProxyFromPairs( bp, m_dispatcher1 );
					getBroadphase().destroyProxy( bp, m_dispatcher1 );
					collisionObject.setBroadphaseHandle( null );
				}
			}


			//swapremove
			m_collisionObjects.Remove( collisionObject );

		}
Ejemplo n.º 2
0
		public virtual void addCollisionObject( btCollisionObject collisionObject
			, btBroadphaseProxy.CollisionFilterGroups collisionFilterGroup = btBroadphaseProxy.CollisionFilterGroups.DefaultFilter
			, btBroadphaseProxy.CollisionFilterGroups collisionFilterMask = btBroadphaseProxy.CollisionFilterGroups.AllFilter )
		{
			Debug.Assert( collisionObject != null );

			//check that the object isn't already added
			Debug.Assert( !m_collisionObjects.Contains( collisionObject ) );

			m_collisionObjects.Add( collisionObject );

			//calculate new AABB

			btVector3 minAabb;
			btVector3 maxAabb;
			collisionObject.getCollisionShape().getAabb( ref collisionObject.m_worldTransform, out minAabb, out maxAabb );

			BroadphaseNativeTypes type = collisionObject.getCollisionShape().getShapeType();
			collisionObject.setBroadphaseHandle( getBroadphase().createProxy(
				ref minAabb,
				ref maxAabb,
				type,
				collisionObject,
				collisionFilterGroup,
				collisionFilterMask,
				m_dispatcher1, null
				) );
		}