void CVehicle::GetRotationDegrees ( CVector & vecRotation ) { if ( m_pAttachedTo ) { GetAttachedRotation ( vecRotation ); ConvertRadiansToDegrees ( vecRotation ); } else vecRotation = m_vecRotationDegrees; }
void CClientCamera::GetRotation ( CVector& vecRotation ) const { CCam* pCam = m_pCamera->GetCam ( m_pCamera->GetActiveCam () ); CMatrix matrix; m_pCamera->GetMatrix ( &matrix ); g_pMultiplayer->ConvertMatrixToEulerAngles ( matrix, vecRotation.fX, vecRotation.fY, vecRotation.fZ ); ConvertRadiansToDegrees ( vecRotation ); vecRotation += CVector ( 180.0f, 180.0f, 180.0f ); if ( vecRotation.fX > 360.0f ) vecRotation.fX -= 360.0f; if ( vecRotation.fY > 360.0f ) vecRotation.fY -= 360.0f; if ( vecRotation.fZ > 360.0f ) vecRotation.fZ -= 360.0f; }
void CClientCamera::GetRotationDegrees ( CVector& vecRotation ) const { CMatrix matrix; GetMatrix( matrix ); matrix.OrthoNormalize( CMatrix::AXIS_FRONT, CMatrix::AXIS_UP ); g_pMultiplayer->ConvertMatrixToEulerAngles ( matrix, vecRotation.fX, vecRotation.fY, vecRotation.fZ ); vecRotation = CVector ( 2*PI, 2*PI, 2*PI ) - vecRotation; ConvertRadiansToDegrees ( vecRotation ); // srsly, f knows, just pretend you never saw this line // vecRotation.fY = 360.0f - vecRotation.fY; // Removed as caused problems with: Camera.rotation = Camera.rotation }
//----------------------------------------------------------------------------------------------- void FirstPersonControllerStrategy::UpdateOrientationFromBlendedPosition( const Vector3f& blendedPosition ) { Vector3f pointToLookAt = ( m_lookAtdistance * GetNonOffsetForwardViewVector() ) - ( m_pose.m_position - blendedPosition ); float rotationZ = 0.f; float rotationY = 0.f; rotationZ = atan2( pointToLookAt.y, pointToLookAt.x ); if( m_pose.m_orientation.yawDegreesAboutZ < 0.f && rotationZ > 0.f ) { rotationZ = rotationZ - TWO_PI; } else if( m_pose.m_orientation.yawDegreesAboutZ > 0.f && rotationZ < 0.f ) { rotationZ = TWO_PI + rotationZ; } if( pointToLookAt.x >= 0 ) { rotationY = -atan2( pointToLookAt.z * cos( rotationZ ), pointToLookAt.x ); } else { rotationY = atan2( pointToLookAt.z * cos( rotationZ ), -pointToLookAt.x ); } rotationY = ConvertRadiansToDegrees( rotationY ); rotationZ = ConvertRadiansToDegrees( rotationZ ); EulerAnglesf offsetOrientation( EulerAnglesf::Zero() ); offsetOrientation.pitchDegreesAboutY = rotationY; offsetOrientation.yawDegreesAboutZ = rotationZ; offsetOrientation = m_pose.m_orientation - offsetOrientation; offsetOrientation = offsetOrientation * m_focusedOnPointAmount; m_pose.m_orientation += offsetOrientation; }
void CClientVehicle::GetRotation(CVector3& vecRotation) { if(IsSpawned()) { // Get the vehicle matrix Matrix matMatrix; m_pVehicle->GetMatrix(&matMatrix); // Convert the matrix to euler angles g_pClient->GetGame()->ConvertRotationMatrixToEulerAngles(matMatrix, vecRotation); // Flip the rotation vecRotation.fX = (2 * PI) - vecRotation.fX; vecRotation.fY = (2 * PI) - vecRotation.fY; vecRotation.fZ = (2 * PI) - vecRotation.fZ; // Convert the rotation from radians to degrees ConvertRadiansToDegrees(vecRotation); } else vecRotation = m_vecRotation; }
int CLuaMatrixDefs::GetRotation ( lua_State* luaVM ) { CLuaMatrix* pMatrix = NULL; CScriptArgReader argStream ( luaVM ); argStream.ReadUserData ( pMatrix ); if ( !argStream.HasErrors () ) { CVector vecRotation; vecRotation = pMatrix->GetRotation ( ); ConvertRadiansToDegrees ( vecRotation ); lua_pushvector ( luaVM, vecRotation ); return 1; } else { m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() ); } lua_pushboolean ( luaVM, false ); return 1; }
///--------------------------------------------------------------------------------- /// very slow ///--------------------------------------------------------------------------------- float Vector2::CalcHeadingDegrees() const { float headingInDegrees = ConvertRadiansToDegrees( CalcHeadingRadians() ); return headingInDegrees; }
//---------------------------------------------------------------------------------------------------- float Xbox::Controller::GetStickAngleDegrees( Stick stick ) const { return ConvertRadiansToDegrees( GetStickAngleRadians( stick ) ); }
void CClientObject::GetRotationDegrees ( CVector& vecRotation ) const { GetRotationRadians ( vecRotation ); ConvertRadiansToDegrees ( vecRotation ); }