Water mesh interaction sound trigger?


photo

Recommended Posts

In the Unigine basic water tutorial it shows how to get splash particles triggering as sparks when objects interact with the water.

Is there a similar method that can be used, or a way to trigger off that spark particle, to trigger a "splash" sound when objects interact with the water mesh? (if not what is the suggested approach to get sounds to trigger when objects interact with water mesh?)

Link to post
  • 4 weeks later...

Was working on some other things in my game and finally got around to trying this again.

Can anyone confirm that callbacks work for BodyWater?

I am using C# and using the callback method in my other bodies (Rigid, Dummy, Fracture) all work fine. Utilizing the same callback code (copy/paste) from those bodies into the BodyWater is not producing any callbacks for me...
bw = new BodyWater(watermesh);
bw.AddContactEnterCallback(contact_callback);
.
.
.
		if (callbacks.Count > 0)
            {
                for (int i = 0; i < callbacks.Count && i<100; i++)
                {
                    contact_callback_handler(callbacks[i].body, callbacks[i].num);
                    callbacks.Remove(callbacks[i]);
                }
                callbacks.Clear();
            }
.
.
.
public void contact_callback(Body body, int num)
        {
            callbacks.Add(new ContactArguments(body, num));
        }
public void contact_callback_handler(Body body, int num)
    {
		if (num >= body.NumContacts)
          return;

		Node effect = World.LoadNode(ReferenceNode);
		effect.WorldPosition = body.GetContactPoint(num);
	}

 

Link to post

AttackGorilla

There is no ContactEnterCallbacks for BodyWater, so your code isn't working. We are thinking to implement them in the future versions (can't say the exact one unfortunately).

Thanks for pointing that out!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Thank you for letting me know. Is there any suggested workaround? 
Do you know if there is a way for another Body (like fracture body) to know it has contacted the water body?

Link to post

Great. Thank you. That is working.

Now I just need to figure out how to code the contact to only trigger periodically and not upon every frame...

Link to post