//----------------------------------------------------------------------------- void C_CHostage::UpdateClientSideAnimation() { if (IsDormant()) { return; } m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] ); // initialize pose parameters char *setToZero[] = { "spine_yaw", "head_roll" }; CStudioHdr *pStudioHdr = GetModelPtr(); for ( int i=0; i < ARRAYSIZE( setToZero ); i++ ) { int index = LookupPoseParameter( pStudioHdr, setToZero[i] ); if ( index >= 0 ) SetPoseParameter( pStudioHdr, index, 0 ); } // orient head and eyes LookAround(); UpdateLookAt( pStudioHdr ); BaseClass::UpdateClientSideAnimation(); }
void Camera::MoveCameraTo(XMFLOAT3 pos, XMFLOAT3 rot) { m_CameraPosition = pos; m_CameraRotation = rot; UpdateLookAt(); }
// look at an object over time void CCamera::LookAt(CObject *object) { CVector v = CVector(object->position - lookAt); initLookAt = lookAt; finalLookAt = object->position; lookAtAccel = -lookAt * 0.25f; UpdateLookAt(); }
Camera::Camera(HWND& hwnd, Player* p, Input* in) : m_Player(p), m_Input(in){ RECT rc = { 0,0,0,0 }; GetClientRect(hwnd, &rc); m_ClientWidth = rc.right; m_ClientHeight = rc.bottom; m_Fov = XMConvertToRadians(45); m_AspectRatio = static_cast<float>(m_ClientWidth) / static_cast<float>(m_ClientHeight); m_NearClip = 0.1f; m_FarClip = 1000.0f; m_CameraPosition = m_Player->GetPosition(); m_CameraLookAt = XMFLOAT3(0.0f, 0.0f, 0.0f); m_CameraUp = XMFLOAT3(0.0f, 1.0f, 0.0f); m_CameraSpeed = 0.02f; m_CameraPosition = XMFLOAT3{ 5.0f, 2.0f, 5.0f }; m_CameraRotation = XMFLOAT3{ 0.0f, 0.0f, 0.0f }; UpdateLookAt(); m_PrevMousePosition = m_Input->GetMousePosition(); }