Adjustments for #3338
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "Config.h"
|
||||
#include "Types.h"
|
||||
|
||||
#include "Engine/Core/Math/Vector3.h"
|
||||
#include "Engine/Core/Types/BaseTypes.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -85,8 +83,7 @@ public:
|
||||
|
||||
FORCE_INLINE static void VelocityChanged(const Vector3& velocity)
|
||||
{
|
||||
if (!velocity.IsNanOrInfinity())
|
||||
Instance->Listener_VelocityChanged(velocity);
|
||||
Instance->Listener_VelocityChanged(velocity);
|
||||
}
|
||||
|
||||
FORCE_INLINE static void TransformChanged(const Vector3& position, const Quaternion& orientation)
|
||||
|
||||
@@ -23,11 +23,11 @@ void AudioListener::Update()
|
||||
{
|
||||
// Update the velocity
|
||||
const Vector3 pos = GetPosition();
|
||||
const float dt = Time::Update.UnscaledDeltaTime.GetTotalSeconds();
|
||||
const float dt = Math::Max(Time::Update.UnscaledDeltaTime.GetTotalSeconds(), 0.00001f);
|
||||
const auto prevVelocity = _velocity;
|
||||
_velocity = (pos - _prevPos) / dt;
|
||||
_prevPos = pos;
|
||||
if (_velocity != prevVelocity)
|
||||
if (_velocity != prevVelocity && !_velocity.IsNanOrInfinity())
|
||||
{
|
||||
AudioBackend::Listener::VelocityChanged(_velocity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user