社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

0 投票
Hello!
I'm very new to Wwise and Unity (and I'm not super familiar with C++ although I know Java) and I'm struggling with one specific thing in my first project.

I'm making sound for a Unity project where I have a water gun that shoots a liquid around.
The way the code is written I have a game object called Paint Manager that handles the task of painting the textures in the environment where the particles shot by the water gun collide with floor/walls.
Right now what I did (simplifying) is posting an event every time the method that was already in place tells the program to paint the surface.
I also set up a simple code to detect how far from the listener the collision happens. (using a RTPC).
However this obviously doesn't take actual position into account, so I don't have proper panning/cone attenuation for each collision happening.
The result is not bad still, but it lacks depth and I feel my solution is a bit spaghetti.
So let's say I have:
- A Vector3 position of the collision, let's call it Vector3 position;
- An event to call, let's call it AK.Wwise.Event Paint;

How would I tell wwise to place every instance of the event in the corresponding position?
Also what components would I have to add to the Paint Manager in order to have everything work properly?
If it's not possible to set up what I'm trying to do this way, what would be the most simple change I can make to achieve the result I want? (remaking or drastically altering the shooting system is not an option for me)

I can provide the code I wrote or extra details if needed
Thank youuu
分类:General Discussion | 用户: Matteo Donato (140 分)

1个回答

+1 投票
 
已采纳

Hi Matteo,

This is an implementation question that might have different solutions. One possible approach could involve creating something like a WaterImpactPrefab that contains a GameObject with an AkEvent component set to trigger on Start. You would then instantiate this prefab each time a collision occurs with the floor or walls, placing it at the specific collision position. The event would be posted automatically at that location.

Another solution could involve creating a GameObject in code whenever a collision happens. You would set the transform.position of that GameObject to your desired Vector, then call Post on your paint event, passing the newly created GameObject to that function.

If you haven't already, I recommend taking the Wwise Unity Integration course and experimenting with the Wwise Adventure Game to get a feel for how the Unity integration works in general and how to post events from scripts.

用户: Alessandro Famà (6.2k 分)
采纳于 用户:Guillaume R. (Audiokinetic)
Very clear answer, thank you!

So in general if I need to position a sound in space I always need a corresponding gameObject at that position or are there workarounds?
(Obviously your solutions are more elegant and scalable than what I was trying to do)

Furthermore, what is the best way to dispose of the object once it's no longer needed? I'm assuming the audio triggered by the event will still play until the end even if I immediately delete the object but I'm not 100% sure about it, is that the case?

I took all the Wwise courses but I kinda powered through them so I'm still connecting some of the dots (and I had 0 Unity knowledge before the 301)
...