void CShadowController::Update( const Vector &position, const QAngle &angles, float secondsToArrival ) { IVP_U_Point targetPosition = m_shadow.targetPosition; IVP_U_Quat targetRotation = m_shadow.targetRotation; ConvertPositionToIVP( position, m_shadow.targetPosition ); m_secondsToArrival = secondsToArrival < 0 ? 0 : secondsToArrival; ConvertRotationToIVP( angles, m_shadow.targetRotation ); m_enable = true; if ( IsEqual( targetPosition, m_shadow.targetPosition ) && IsEqual( targetRotation, m_shadow.targetRotation ) ) return; m_pObject->Wake(); }
void CPhysicsObject::RecheckCollisionFilter() { // Remove any collision points that we shouldn't be colliding with now btOverlappingPairCache *pCache = m_pEnv->GetBulletEnvironment()->getBroadphase()->getOverlappingPairCache(); btBroadphasePairArray arr = pCache->getOverlappingPairArray(); CCollisionSolver *pSolver = m_pEnv->GetCollisionSolver(); for (int i = pCache->getNumOverlappingPairs()-1; i >= 0; i--) { btBroadphasePair &pair = arr[i]; btCollisionObject *pBody0 = (btCollisionObject *)pair.m_pProxy0->m_clientObject; btCollisionObject *pBody1 = (btCollisionObject *)pair.m_pProxy1->m_clientObject; CPhysicsObject *pObj0 = (CPhysicsObject *)pBody0->getUserPointer(); CPhysicsObject *pObj1 = (CPhysicsObject *)pBody1->getUserPointer(); if (pObj0 != this && pObj1 != this) continue; // Don't check objects that aren't me CPhysicsObject *pOther = pObj0 == this ? pObj1 : pObj0; if (pSolver && !pSolver->NeedsCollision(pObj0, pObj1)) { pCache->removeOverlappingPair(pair.m_pProxy0, pair.m_pProxy1, m_pEnv->GetBulletEnvironment()->getDispatcher()); pOther->Wake(); // Wake it up because shit changed } } }