Want to make an item disappear on click when hovered over


Im trying to make a simple game in Oculus quest where you pop bubbles by pressing the trigger. I have correctly set up the line trace and attached a beam system to it to make it visible, I am just unsure as how I can reference other objects within my blueprint as It won’t let me add it as a simple reference variable.

I am currently working in the blueprint for the motion controls. The bubble is also a blueprint actor as I will attach events to that that will fire when clicked on, so any help in setting that up would also be appreciated.

Thanks for looking,

the ‘hit actor’ output of the hit result struct should return your bubble. So you can either cast to the bubble class or you could make an interface call to the actor. then call the destroy actor function which should be in the bubble blueprint.

draw a debug line to make sure the line trace is hitting the bubbles.

Thank you for your reply. I’m trying the cast to bubble actor at the moment and not having any joy. When I run my traces in debug mode they’re permanently green, which I assume isn’t a good sign?

linetraces are red until they hit something then turn green. run a print string to find out what the “hit component” is. you’re probably hitting yourself with the trace. the ignore self check box should make the trace miss the capsule collision you probably have as the root of your character, but I don’t think it would ignore other components. like if you have a sphere collision or skeletal mesh hands it could hit that.

[edit: ignore self seems to ignore components as well as the root. maybe it has something do with how the vr character in unreal’s template uses separate actors for the hands.]

either offset the line trace start so it doesn’t intersect with yourself, or set the components to ignore visibility traces.

you could also do a multi line trace instead which will return an array of actors you can loop through. you’d want to do that if you want to pop multiple bubbles with one beam.