How to trigger action by being in range of object

Hi,

for my uni project I have been working on a VR experience and I have been stuck for days. My goal at the moment is to create an object, and when I’m close to the object I can click on a button to trigger the audio. I have tried this with a collision box now, but the collision box doesn’t seem to work at all. I even tried to connect the On Component Begin Overlap with a print string, but nothing happens. I would also be open to triggering the action with something else, for example by looking at the object or being in range of it, but I have no idea how to trigger something like that with something else than a collision box. What am I doing wrong? Can anyone help?

This is what I have till now:


1 Like

For collisions to work, both objects, in this case your collision component and at least one component in your character need to have collision enabled, both need to have Generate Overlap Events enabled, and their collisions need to be compatible. For example, if your collision to detect the range is let’s say of type World Dynamic, then your character needs to have at least one component with collision that is set to Overlap with World Dynamic.

You can read more about collisions here: Collision Overview | Unreal Engine Documentation

2 Likes

On both objects Generate Overlap Events has been enabled and I used the ‘OverlapAllDynamic’ preset, but the whole box just doesn’t seem to do anything when previewing in VR. And like I said not even the printstring is working :confused:

Can you show your collision settings for your character and the PC box collider?

Here are the screenshots of my collision settings. I’m not entirely sure if I should be looking at my motioncontrollers or the HMD (headset) for colliding, so I’ve just attached screenshots of both



Ok so from what I can see, the VR pawn does not have any colliding components by default, other than the HMD mesh, which is set to No Collision and is also hidden from the player. So what you can do is you can add a Capsule Collision component at the root of your pawn, and set its collision settings to maybe Overlap All, or custom and only enable the channels that you want, and also make it Generate Overlap Events, and that should solve your issue.

This was my test project:

image

ezgif.com-gif-maker

I don’t have a VR headset so I had to test it like that but I’m guessing it will work the same way

1 Like

i have been stuck on this all week because none of my collision boxes weren’t working!!! Thank you so much this helped!!!