After manipulating the camera’s CFrame, the player perceives sound from 0,0,0, facing 180, instead of where the camera actually is.
(This uses modified code from (4) Super Camera Skewer 64 - Roblox, which the same problem also applies there.)
Here’s the code that adjusts the camera stretch/rotation. I used all R00-R22 but left the x,y,z coordinates alone.
RunService.RenderStepped:Connect(function()
local x = tick() * 0.5
r00, r11, r22 = --buncha math
r01, r10, r20, r21 = --math
r02, r12 = --pie
-- adjust the camera cframes and apply each step
camera.CFrame = camera.CFrame * CFrame.new(0,0,0,r00,r01,r02,r10,r11,r12,r20,r21,r22)
local scaleX = math.sign(r01)
local scaleY = math.sign(r12)
_G.RotateScale = Vector2.new(scaleX,scaleY)
end)
Here’s what I mean. Listen for the footsteps with headphones:
Spaceship Bar - Roblox Studio 2023-07-13 21-20-52 (sorry, don’t know how to embed streamable links )
Thanks for your help!
UPDATE:
Did a little bit of experimenting, here’s what I found:
Sound stops tracking after
- |R01| > 0.330
- R11 < 0.95
- |R21| > 0.315
- R22 < 0.95
Once any of these checks are met, the point of where the camera was when the value changed is the point where audio is perceived until reverted to a safe value. I am not SetListener
’ing anywhere.
All other parameters are safe to mess with and will keep sound relative to the camera. I think this might be an engine bug.