Skip to content

Commit

Permalink
ChaosMod/EffectSound3D: Use camera rotation for listener direction
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Jan 16, 2025
1 parent bc26b53 commit fe532ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ChaosMod/Components/EffectSound/EffectSound3D.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <stdafx.h>

#include "Util/Camera.h"

#include "EffectSound3D.h"

#define MINIAUDIO_IMPLEMENTATION
Expand Down Expand Up @@ -39,8 +41,8 @@ void EffectSound3D::OnRun()
auto adjPlayerCoords = GET_ENTITY_COORDS(playerPed, true) * SOUND_RANGE_MULT;
ma_engine_listener_set_position(&m_maEngine, 0, adjPlayerCoords.x, adjPlayerCoords.y, adjPlayerCoords.z);

auto playerForward = GET_ENTITY_FORWARD_VECTOR(playerPed);
ma_engine_listener_set_direction(&m_maEngine, 0, playerForward.x, playerForward.y, playerForward.z);
auto camRot = Util::DegToRadian(GET_GAMEPLAY_CAM_ROT(2));
ma_engine_listener_set_direction(&m_maEngine, 0, camRot.x, camRot.y, camRot.z);

auto playerVeh = GET_VEHICLE_PED_IS_IN(playerPed, false);
auto playerIsInAnyVeh = IS_PED_IN_ANY_VEHICLE(playerPed, false);
Expand Down

0 comments on commit fe532ef

Please sign in to comment.