Hi!
For uni I’m working on a small VR experience. I want the objects in my environment to tell a story. Right now I’m working on that when I come close to an object it will say ‘press the b button’ and when I click on the button an audio plays to reveal more information. I’ve tried multiple youtube tutorials but none seem to work for me. For example now I tried to create an action mapping that would make an audio play, but nothing happens when I press on the button. How do I do this?
The handling of your input action needs to be inside of an actor that actually listens to and reacts to input such as your pawn or player controller.
Hi Nxneteen,
As a quick fix - In BP_Computer: Click on Class Defaults and set ‘Auto Receive input’ to “Player 0”
For a little more info on what ghostfasel said - Ultimately you don’t really want your inputs spread out in many blueprints, so centralizing the triggering/sending of these events is best practice.
Hope that helps
Thank you! This helped for now, I will look into what gh0stfase1 said later. Now, how would I go about it if I only want it to play when I click the button close to the object? At the moment it plays everytime I click on the button, no matter where I stand.
I tried to connect my interaction in my VRPawn, but for some reason it’s not working… What am I doing wrong?
Nice progress. That looks closer to a proper implementation of your desired feature. I’m not sure what you’ve done or haven’t done but a good skill to acquire is the ability to debug. Start putting in print statements using the “PrintString” node. When working a problem like this it’s most useful to start from the beginning to make sure the execution flow is working as expected. Put one right after the input action to make sure the key is actually getting pressed. Following that, print out each overlapping actor that is returned (if any). That way we can get a sense of where the breakdown might be.
Unfortunately every time I simulate the game in VR all the panels close which makes it impossible to debug since I can’t see my blueprint/debugging panel anymore and I have no idea how to fix that
Indeed, debugging in VR is a slightly different experience than outside of it. A print string node will print text to the top left corner of your view which is impossible to see. The good thing is that the print string node, by default, also prints to the output log. You can access the output log a couple of different ways but you should see a tab for it in the bottom left corner of the editor after the content browser. Messages created with print string are going to show up with something like “LogBlueprintUser…” or “LogUserBlueprint…”. The log search is pretty forgiving so you can use something along those lines to filter for your messages. There are of course slightly more advanced ways to try and get this sort of stuff in view of the VR headset but it’s best to stick with the basics for now.
Hello, looking at the picture of your setup, I’d check to see if ‘Get overlapping actors’ is seeing your motion controller. (Collision channels might need to be configured)
Protip: you can use a ‘for loop’ with a print-string to flood your with many (10-20) of the same string. That way instead of the print string basically being hidden in the upper left, it gets more into your field of view. Also you can append some spaces before the string to push it closer to the center of your view.
Sending the ‘trigger impulse’ from the pawn to the object is a great way to do things. But it’s also possible to have a more ‘object centric’ approach, where instead of using interfaces you try to call a function on the object. (More than one way to skin a dragon)