Add SetActive function

This commit is contained in:
Georg Hagen
2025-01-30 00:13:53 +01:00
parent a2d4d61bc9
commit da299d6430
2 changed files with 12 additions and 0 deletions

View File

@@ -51,6 +51,16 @@ namespace OpenVulkano
CURRENT_FRAME.needsRedraw = true; CURRENT_FRAME.needsRedraw = true;
} }
void FreeCamCameraController::SetActive()
{
if (!GetCamera()) return;
Math::Vector3f viewDir = Math::Utils::normalize(GetCamera()->GetViewDirection());
m_position = GetCamera()->GetPosition();
m_pitch = Math::Utils::asin(viewDir.y);
m_yaw = Math::Utils::atan(-viewDir.x, -viewDir.z);
}
void FreeCamCameraController::SetDefaultKeybindings() void FreeCamCameraController::SetDefaultKeybindings()
{ {
m_actionForward->BindKey(Input::InputKey::Controller::AXIS_LEFT_Y); m_actionForward->BindKey(Input::InputKey::Controller::AXIS_LEFT_Y);

View File

@@ -46,5 +46,7 @@ namespace OpenVulkano
void Tick() override; void Tick() override;
void SetDefaultKeybindings(); void SetDefaultKeybindings();
void SetActive() override;
}; };
} }