Pitch changes with angle of the ship

This commit is contained in:
Tleety
2015-06-02 01:00:48 +02:00
parent 26ecad5be0
commit 242fa2eaaa
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -136,6 +136,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
float TurnSpeed = 1.0f;
glm::vec3 Euler = glm::degrees(glm::eulerAngles(transform->Orientation));
PitchAngleAdd = (float(abs(Euler.z))*float(abs(Euler.z))) / (25.0f*25.f);
// Controls
if(input->KeyState[GLFW_KEY_LEFT]) {
@@ -266,10 +267,11 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
transform->Velocity.z = m_maxspeed;
}
//Engine sound
float percentage = m_poweruptimeleft / m_PowerUpTotalDuration;
SetPlayerLightColor(entity, glm::vec3(0.0, 1.0, 0.0) * percentage + (1.f - percentage) * glm::vec3(0.05f, 0.36f, 1.f));
auto soundEmitterEngine = m_World->GetProperty<Components::SoundEmitter*>(entity, "SoundEmitterEngine");
soundEmitterEngine->Pitch = 1.f + percentage * 0.5f;
soundEmitterEngine->Pitch = 1.f + percentage * 0.5f + PitchAngleAdd * 0.5f;
// Update camera
if(! freecamEnabled)
+1
View File
@@ -34,6 +34,7 @@ namespace Systems
glm::vec3 m_PlayerOriginalBounds;
glm::vec3 m_CameraOffset;
glm::quat m_CameraOrientation;
float PitchAngleAdd;
bool freecamEnabled;