VR interactivity constraints?

I am trying to interact with objects in my VR game, and most tutorials I see are for free moving objects, but I am not looking for that. I specifically want to interact with objects that have constraints. For example: levers, hinges, sliders, etc. And also some objects that can be moved only in Z and Y (pitch and yaw), with a constrained pivot, sort of like a mounted gun.

Here is my WIP, so far I want to focus on the gun functionality, and then move onto the levers and stuff.

link text

VRExpansion plugin handles pretty much all of that, if you don’t want to use it in your project you could probably download the demo and see how it is handled there.

I tried installing it a while back, never worked even with all the visual studio installs and updates. It was a nightmare.

Here is where I am at now. WIP_RS_GUN on Vimeo
I tried something called Mitch’s VR Templates. It has a lot of the functionality of what I need, however they all pertain to a single axis. When I try to combine an actor with both a pitch and yaw function it only does the yaw. The yaw was basically code for a door, I just extended the max and min angle to be -45 , 45.

The pitch is in parented below the yaw so they move independently. I included the blueprints:

You’ll notice that there are multiple functions that work with my VR pawn character. There is a ‘drag start’ ‘drag’ ‘drag stop’. The top portions are for the yaw, where I didn’t mess with the original blueprint, just replaced it with my meshes. Below that is a duplicate of the yaw nodes, but I just switched the meshes and the axis to be pitch. But still only the Yaw works.


Your code is startsimulategunphysics for pitch, but you have the gun going to door physics, might be part of the problem.

If that doesn’t work out for you let me know and i’ll actually do some testing for you, but i really think your problem is that simple.

Ok I’ll take a look. Sorry about the weird naming, the comments say ‘door’ because that was in the template. The original purpose of the simulate was to let go and have the gun still move slightly and slow down to a full stop. It was a cool effect but not totally necessary. Thanks!

Cool thanks. I’ll check tonight when I get home from work.

It did not work unfortunately. I suspect it’s an issue with child component inheritance overriding my rotations. I can send you my project. I made a clean simple version to get started with. I’m uploading it to my google drive right now. I’ll give you a link when it’s ready.

Here is the google drive link to the project. FYI, the gun movement uses the VIVE controller, and it’s using the grip buttons, not the trigger.


alright i’ll be home in about an hour or two and i’ll check it out for you. Should be able to get it straightened out tonight, or at least narrow down the problem for you.

Thank you! I really appreciate it.

Ok I’ll try and clean it up more. Or just send you the full file. I probably deleted too much when trying to slim the project down.

Well i downloaded it to take a look, but the project you sent was very broken, based on errors it looks like multiple missing classes.
Example: Can’t find file for asset. /Game/ExampleContent/VR_World_Interaction/Blueprints/InteractiveObjects/BP_MG_O
plus many more, most are just meshes so not a big deal, but the BP classes that are missing make it to where any code through blueprints you had in the project are completely broken so i don’t even have a basis to start looking for you.

I don’t mind large file sizes if you want to send the full file to make sure it’s good.

Here is the new link for the larger file. https://drive.google.com/open?id=1MRXSHdZD119PInm4m782sNtyy49HY82R

It contains a lot of the VR templates from the original file, like doors, levers etc… you can look at those too and see how those are setup too.
BP_MG_Test should be the main gun blueprint with all the parts. There is also a backup folder with all of my iterations.

Hope this one works out.

Thanks again.

got it pretty much working for you, you had a lot of redundant code that was overwriting itself, and somethings just pointing to the wrong area. It’s a bit cleaner now, want me to zip up and upload the project or just show you the blueprints?

If you could upload that would be great. Thank you so much!

Here’s the updated file. Combined the yaw and pitch into single handlers, got rid of the gun handle event entirely, changed the initial offset to also include an initial pitch offset, updated the atan2’s to correctly use x and z for the pitch, and cleaned up the start and stop drag functions as well. If you have any questions about it let me know. Gun Test Download

Yeah that works! Thank you for fixing that. Is there a way to get the pitch to be more sensitive? It’s easy to move the yaw, but if I move my hands up and down too fast it lets go of the gun and gets stuck and I have to grab it again.