| 25 | } |
| 26 | |
| 27 | void FirstPersonShooterCamera::SetPosition(const Maths::Vector3& position) { |
| 28 | Camera::SetPosition(position); |
| 29 | Maths::Vector3 direction = m_position - m_target; |
| 30 | m_radius = Maths::length(direction); |
| 31 | |
| 32 | Maths::Quaternion quat_around_y = Maths::angleAxis(m_yaw_angle, Maths::Vector3(0.0f, 1.0f, 0.0f)); |
| 33 | Maths::Quaternion quat_around_x = Maths::angleAxis(m_pitch_angle, Maths::Vector3(1.0f, 0.0f, 0.0f)); |
| 34 | Maths::Quaternion quat_around_yx = quat_around_y * quat_around_x; |
| 35 | |
| 36 | direction = Maths::rotate(Maths::normalize(quat_around_yx), Maths::normalize(direction)); |
| 37 | m_position = m_target + (m_radius * direction); |
| 38 | m_forward = Maths::normalize(m_position - m_target); |
| 39 | |
| 40 | UpdateCoordinateVectors(); |
| 41 | PerspectiveCamera::UpdateViewMatrix(); |
| 42 | } |
| 43 | |
| 44 | void FirstPersonShooterCamera::Move(const Maths::Vector3& offset) { |
| 45 |
nothing calls this directly
no outgoing calls
no test coverage detected