I have a gaze system setup with linetraces, and whenever I look at an object, a title and descriprion shows in text form beside it. After a few seconds, the text dissapears and you have to look at the object again to prompt the text again.
I have several diferent objects in the level and each one of them has a different sound i need it to play, when i look at it.
Example: If I’m looking at the object 1 and i look to the object 2… the sound from object 1 stops and the sound from the object 2 starts… this for all the different objects in the level, no matter the order.
I can’t figure out how to properly do this, since my current setup only plays the sound once per object.
Here’s my setup (I’m probably overcomplicating this, as usual… so bare with me )
1 - This event is the one that happens once i look at the object.
It cast to the game engine the a name tag from a specific object. and also sets the sound i need to play from it.
2- Then, in my game instance, I receive this name tag information… That is sorted into a “switch on name”, so that I can define a particular sequence of events to a particular object.
You have a non-scalable system here. The more stuff you have in the game, the more of a nightmare it becomes.
A better way would be the objects talking to the player with an interface call.
The object can make it’s own text, and that would be a blueprint inheritance thing, so all inspectable objects descend from one blueprint. But the sound can be passed to the player over an interface call.
That way, the player is in control of what sound is playing when.
I do have to change a few things in my BP, because I have it set that I can only look again at the object when the sequence finishes, and the audio is at the begining of the sequence.
That makes it so that I cant look in between objects and have it “constantly” start and stop…
But, it works very well and how it’s supposed too.