Add movement speed modifier

This commit is contained in:
Georg Hagen
2024-10-11 11:53:10 +02:00
parent 5873601a02
commit 0ff4d391c2
2 changed files with 5 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ namespace OpenVulkano
//vec = Math::Utils::normalize(vec);
}
const float timeScale = CURRENT_FRAME.frameTime; //TODO
vec = vec * timeScale * 3.0f; // scale vector
vec = vec * timeScale * m_movementSpeedModifier; // scale vector
vec = GetCamera()->GetRotationMatrix() * Math::Vector3f(vec);
const Math::Vector4f_SIMD movement(vec, 0);
m_framePosition += movement;

View File

@@ -35,6 +35,8 @@ namespace OpenVulkano
bool m_frameUpdated = false, m_distUpated = true;
bool m_lockYaw = false, m_lockPitch = false;
float m_movementSpeedModifier = 3;
void SetupInputActions();
void HandleRotation();
@@ -66,9 +68,11 @@ namespace OpenVulkano
[[nodiscard]] float GetYaw() const { return m_yaw; }
[[nodiscard]] float GetPitch() const { return m_pitch; }
[[nodiscard]] float GetDistance() const { return m_distance; }
[[nodiscard]] float GetMovementSpeedModifier() const { return m_movementSpeedModifier; }
void SetYaw(float y) { m_yaw = y; }
void SetPitch(float p) { m_pitch = p; }
void SetDistance(float dist) { m_distance = dist; m_distUpated = true; }
void SetMovementSpeedModifier(float speed = 3) { m_movementSpeedModifier = speed; }
};
}