【求助】关于GMS2的3D音效不随距离衰减问题
gamemaker吧
全部回复
仅看楼主
level 1
我想要使用Emitter和Listener来达到比较真实的火焰燃烧声音效果,能从声音听出方向和大概距离。
现在问题是人物在火焰附近移动,可以分辨出火焰燃烧声音的方向,但是听不出距离感,这个声音不会衰减,人物离火焰多远都没有用。用的是 audio_emitter_falloff() 这个函数,这个函数有使用前提吗?翻了帮助手册半天没搞明白,只好来求助一下贴吧各位大佬
游戏里只有两个object,一个是火焰,火焰发出声音。另一个是人物,监听器跟随人物。
火焰用的代码如下:
s_emit = audio_emitter_create(); //创建发射器
audio_emitter_position(s_emit, x, y, 1); //发射器跟随火焰
audio_emitter_falloff(s_emit, 100, 300, 1); //设置发射器的声音衰减
audio_play_sound_on(s_emit,snd_burn,1,1); //发射器播放燃烧的声音
人物的代码如下:
//人物移动,不是重点不贴了
audio_listener_position(x, y, 0); //监听器跟随人物
大佬们99孩子吧
2020年05月10日 17点05分 1
level 14
根据距离设置音量大小呗。越近音量越大,越远音量越小。
audio_master_gain(gain);
With this function you can set the absolute value for the global volume of all sounds and music. It is based on a linear scale from 0 (silent) to 1 (full volume) and will affect the relative volume of all sounds and music played from within your game.
2020年05月11日 00点05分 2
level 1
搞定了,不是函数不起作用的问题,需要一些别的工作,这个函数才可以正常用
2020年05月11日 07点05分 3
1