-
What do you want to achieve? Keep it simple and clear!
I’m making a sound manager based on playing music/ambience assigned to certain areas of the game using parts and raycasts. -
What is the issue? Include screenshots / videos if possible!
The parts used to label areas for designated music/ambience have weird collissions, it seems as if the collisions for parts are closer to the 0,0,0 position meanwhile the parts themselves visually stay in the same place as before the playtesting. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to change the origin of the raycast from player’s root part position to player’s torso position then to the current camera’s position, nothing affected the issue.
-- snippet of the raycast code part itself in the local script in StarterPlayerScripts
while task.wait(.1) do
local og = workspace.CurrentCamera.CFrame.Position
local dir = og - Vector3.new(0,30,0)
local R1 = workspace:Raycast(og, dir, RCP1)
if R1 and R1.Instance then
local amb = R1.Instance:FindFirstChildOfClass("Sound")
local folder = R1.Instance:FindFirstChildOfClass("Folder")
if not folder or #folder:GetChildren() == 0 then
SFX_Folder = nil
else
SFX_Folder = folder
end
if CA.SoundId ~= amb.SoundId then
changeAmbient(amb)
end
else
changeAmbient(script.Sound)
end
local R2 = workspace:Raycast(og, dir, RCP2)
if R2 and R2.Instance then
local song = R2.Instance:FindFirstChildOfClass("Sound")
if CS.SoundId ~= song.SoundId then
changeMusic(song)
end
else
changeMusic(script.Sound)
end
end
I’ll provide videos presenting the issue if needed, thank you for any of the answers