static btGhostObject* upcast( btCollisionObject colObj ) { if( colObj.getInternalType() == CO_GHOST_OBJECT ) return (btGhostObject*)colObj; return 0; }
void updateSingleAabb( btCollisionObject colObj ) { btVector3 minAabb, maxAabb; colObj.getCollisionShape().getAabb( ref colObj.m_worldTransform, out minAabb, out maxAabb ); //need to increase the aabb for contact thresholds btVector3 contactThreshold = new btVector3( btPersistentManifold.gContactBreakingThreshold, btPersistentManifold.gContactBreakingThreshold, btPersistentManifold.gContactBreakingThreshold ); minAabb.Sub( ref contactThreshold, out minAabb ); maxAabb.Add( ref contactThreshold, out maxAabb ); //minAabb -= contactThreshold; //maxAabb += contactThreshold; if( getDispatchInfo().m_useContinuous && colObj.getInternalType() == btCollisionObject.CollisionObjectTypes.CO_RIGID_BODY && !colObj.isStaticOrKinematicObject() ) { btVector3 minAabb2, maxAabb2; colObj.getCollisionShape().getAabb( ref colObj.m_interpolationWorldTransform, out minAabb2, out maxAabb2 ); minAabb2.Sub( ref contactThreshold, out minAabb2 ); maxAabb2.Add( ref contactThreshold, out maxAabb2 ); minAabb.setMin( ref minAabb2 ); maxAabb.setMax( ref maxAabb2 ); } btBroadphaseInterface bp = (btBroadphaseInterface)m_broadphasePairCache; //moving objects should be moderately sized, probably something wrong if not if( colObj.isStaticObject() || ( btVector3.BetweenLength2( ref minAabb, ref maxAabb ) < (double)( 1e12 ) ) ) { bp.setAabb( colObj.getBroadphaseHandle(), ref minAabb, ref maxAabb, m_dispatcher1 ); } else { //something went wrong, investigate //this assert is unwanted in 3D modelers (danger of loosing work) colObj.setActivationState( ActivationState.DISABLE_SIMULATION ); if( reportMe && m_debugDrawer != null ) { reportMe = false; m_debugDrawer.reportErrorWarning( "Overflow in AABB, object removed from simulation" ); m_debugDrawer.reportErrorWarning( "If you can reproduce this, please email [email protected]\n" ); m_debugDrawer.reportErrorWarning( "Please include above information, your Platform, version of OS.\n" ); m_debugDrawer.reportErrorWarning( "Thanks.\n" ); } } }