void CLeanMgr::CalculateNewPosRot( LTVector &vOutPos, LTRotation &rOutRot, float fAngle ) { float fPitch = g_pPlayerMgr->GetPitch(); float fYaw = g_pPlayerMgr->GetYaw(); float fRoll = g_pPlayerMgr->GetRoll(); // Use the current camera angles and just add the new roll for the camera rotation... rOutRot = LTRotation( fPitch, fYaw, fRoll + fAngle ); // Don't factor in the pitch so the position isn't affected by it... LTMatrix mRotation; LTRotation rRotation( 0.0f, fYaw, fRoll + fAngle ); rRotation.ConvertToMatrix( mRotation ); vOutPos = (mRotation * m_vRotationPtOffset) + m_vRotationPt; // Make sure we are actually in the world before we try to clip... ClientIntersectQuery iQuery; ClientIntersectInfo iInfo; iQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID | INTERSECT_HPOLY; iQuery.m_From = m_vRotationPt + m_vRotationPtOffset; iQuery.m_To = vOutPos; if( g_pLTClient->IntersectSegment( &iQuery, &iInfo )) { vOutPos = iInfo.m_Point + iInfo.m_Plane.m_Normal; } // Keep us far away from walls to avoid clipping... float fCamClipDist = g_vtCameraClipDistance.GetFloat(); g_vtCameraClipDistance.SetFloat( g_vtLeanCamClipDist.GetFloat() ); g_pPlayerMgr->GetPlayerCamera()->CalcNonClipPos( vOutPos, rOutRot ); g_vtCameraClipDistance.SetFloat( fCamClipDist ); }
//an internal update functionality that must be called at the start of each effect's update //function. This does not return any value so it does not need to be checked void CBaseFX::BaseUpdate(float fTimeInterval) { LTASSERT(IsActive() && !IsSuspended(), "Error: Updated an effect that was either suspended or inactive"); //update the elapsed time m_tmElapsed += fTimeInterval; //handle updating the additional rotation of this object for this frame if(GetProps()->m_bUpdateRotation) { LTVector vAngles = GetProps()->m_vfcRotation.GetValue(GetUnitLifetime()); LTRotation rRotation( MATH_DEGREES_TO_RADIANS(vAngles.x) * fTimeInterval, MATH_DEGREES_TO_RADIANS(vAngles.y) * fTimeInterval, MATH_DEGREES_TO_RADIANS(vAngles.z) * fTimeInterval); m_rAdditional = rRotation * m_rAdditional; } //update our parent transformation as long as we aren't fixed, and actually have a parent if((m_hParentObject || m_hParentRigidBody) && (GetProps()->m_eFollowType != eFXFollowType_Fixed)) { UpdateParentTransform(); } }