Custom Action/Observable Message Bus Possible?

I’m looking for a babylon-way to create custom events that different objects within my scene would listen for and react to when heard. I looked through the Actions and Observables documentation, but not necessarily seeing what I need. What’s the best “all-Babylon” method of creating a message bus that supports custom messages that entities could subscribe to and execute callbacks when heard?

I stumbled onto a web-browser driven method but looking to keep it as much straight-up babylon code as I can. Creating and triggering events - Developer guides | MDN

You want to use the Observable as this is how we handle all events and messages internally :wink:

https://doc.babylonjs.com/how_to/observables

1 Like

That’s funny–I glossed over that page originally and totally missed the example doing exactly what I was looking for. Thank you!

1 Like