VR Rail Shooter

Hi everyone,

I’m working on a VR rail shooter for the Oculus Rift and have been able to pick up the gun using the touch controllers, but can’t figure out how to make the line trace shoot from the gun instead of where the HDM is looking. I have the gun as a separate blueprint from the player blueprint, unless it would be better(or make more sense) to add the gun to the player’s blueprint. I want to use line trace as the gun will essentially be a laser tag type system.

Ultimately I’d like to spawn with the gun attached to the motion controller or be able to pick it up at the beginning; whichever is easier for getting the line trace to work.

Still trying to wrap my head around blueprints so any and all advice is appreciated, thanks!

Thanks for the help vr_marco! Unfortunately, I wasn’t able to get it to work still. I tried at least three different options to try to get it to work.

In the first option, I tried using the motion controllers(R Motion Controller specifically) that spawn with the pawn for the line trace, like you had suggested, but that didn’t seem to work. The second option I used the gun blueprint(which is separate from the pawn blueprint) to try to generate the line trace. With this option I tried both the StaticMeshComponent(Gun) as well as the GunArrow, with no luck for either. With the third option I decided to try adding a gun to the BP_MotionController and tried both the gun and gun arrow as two separate options again with no luck of getting it to work.

For each of these tests, I made sure to disable the inputs for the ones I wasn’t testing to avoid any problems. So the pawn doesn’t have a gun attached to it, and like I mentioned has a separate blueprint that I use to pick up the gun after the level starts. It sounds like I may either need to figure out a way for the BP_Gun and BP_CoasterCar_DemoPawn to communicate with each other OR figure out a way to add the gun to the pawn so the player starts off with the gun in their hand from beginning(which would be perfectly fine with me).

Again, thanks in advance for any help!

I have the pawn receiving player 0 input, if that’s what you mean.

I was able to get the line trace to cast from the right motion controller which seems like a passable fix, but I just need to figure out how to add a vector that will offset the line trace from the hand to a position a little closer to where the barrel of the gun is. Here’s the blueprint I used in addition to making sure motion controller trigger blueprint is set to the right input.

@vr_marco I actually just was using the destroy actor as a way to see if the blueprint was working correctly, which it wasn’t as the actor didn’t destroy when I hit it. I don’t want to destroy the actor at all, and just want to have points added to the score when it’s hit. I had followed this tutorial series, but didn’t seem to have success getting it to work properly. I would imagine that I’d also use a similar setup using a blueprint interface to get an animation to play once the line trace hits it.