Jump to content

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 comment
  • 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 comment

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 comment
×
×
  • Create New...