Allow orientation locking arch ball controller
This commit is contained in:
@@ -26,8 +26,8 @@ namespace OpenVulkano
|
||||
{
|
||||
if (!GetCamera()) return;
|
||||
Input::InputManager* input = Input::InputManager::GetInstance();
|
||||
float inYaw = input->GetAxis(m_actionLookSide);
|
||||
float inPitch = input->GetAxis(m_actionLookUp);;
|
||||
float inYaw = (lockYaw) ? 0 : input->GetAxis(m_actionLookSide);
|
||||
float inPitch = (lockPitch) ? 0 : input->GetAxis(m_actionLookUp);
|
||||
Math::Vector4f_SIMD position = GetCamera()->GetPosition();
|
||||
bool updated = false;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace OpenVulkano
|
||||
{
|
||||
Math::Vector4f_SIMD m_pivotPoint{ 0, 0, 0, 1 };
|
||||
float yaw = 0, pitch = 0;
|
||||
bool lockYaw = false, lockPitch = false;
|
||||
|
||||
Input::InputAction* m_actionForward = nullptr;
|
||||
Input::InputAction* m_actionSide = nullptr;
|
||||
@@ -45,5 +46,14 @@ namespace OpenVulkano
|
||||
void SetDefaultKeybindings();
|
||||
|
||||
void Init(Scene::Camera *camera) override { CameraController::SetCamera(camera); SetActive(); }
|
||||
|
||||
void LockYaw(float value = INFINITY, bool locked = true) { lockYaw = locked; if (value != INFINITY) yaw = value; }
|
||||
void LockPitch(float value = INFINITY, bool locked = true) { lockPitch = locked; if (value != INFINITY) pitch = value; }
|
||||
|
||||
[[nodiscard]] float GetYaw() const { return yaw; }
|
||||
[[nodiscard]] float GetPitch() const { return pitch; }
|
||||
|
||||
void SetYaw(float y) { yaw = y; }
|
||||
void SetPitch(float p) { pitch = p; }
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user