# VR interactivity constraints?

**URL:** <https://forums.unrealengine.com/t/vr-interactivity-constraints/425880>\
**Category:** XR Development\
**Tags:** interactive-objects, interaction, unreal-engine, question\
**Created:** [May 24, 2018, 7:16pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880 "2018-05-24T19:16:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [May 24, 2018, 7:16pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/1 "2018-05-24T19:16:34Z")

</div>

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](https://vimeo.com/270933978)

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [May 30, 2018, 8:44pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/2 "2018-05-30T20:44:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [May 31, 2018, 4:38am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/3 "2018-05-31T04:38:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [May 31, 2018, 4:33pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/4 "2018-05-31T16:33:03Z")

</div>

Here is where I am at now. [WIP\_RS\_GUN on Vimeo](https://vimeo.com/272712637)  
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.

![242739-hierarchy-wip.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/9/f199f608bbfdb38cbb5b9e2d6366b6e12ca8ffa8.jpeg)

 ![242740-event-graph.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/a/1/fa14389f6e25b0b9f12fb96930d44f64f5225391.jpeg)

 ![242751-drag-start.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/0/8b05e14781e655adaccb27d0345b6dac50a4000f.jpeg)

 ![242752-drag.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/9/9e9b53e339e58820c0945bbb46d2eac53bb6cdf8.jpeg)

 ![242753-drag-stop.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/b/94b4a8da342cd1fbf82002e53ab310f3f89e78aa.jpeg)

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [May 31, 2018, 4:55pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/5 "2018-05-31T16:55:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [May 31, 2018, 5:51pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/6 "2018-05-31T17:51:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [May 31, 2018, 5:52pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/7 "2018-05-31T17:52:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [May 31, 2018, 6:03pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/8 "2018-05-31T18:03:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 1, 2018, 3:24am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/9 "2018-06-01T03:24:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 1, 2018, 3:53am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/10 "2018-06-01T03:53:50Z")

</div>

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.

[https://drive.google.com/open?id=1rn3jwLOQD\_E8R62KOkyIuifvg5vkYTv3](https://drive.google.com/open?id=1rn3jwLOQD_E8R62KOkyIuifvg5vkYTv3)

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [June 1, 2018, 3:59am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/11 "2018-06-01T03:59:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 1, 2018, 4:01am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/12 "2018-06-01T04:01:22Z")

</div>

Thank you! I really appreciate it.

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [June 1, 2018, 4:26pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/13 "2018-06-01T16:26:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 1, 2018, 4:46pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/14 "2018-06-01T16:46:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [June 1, 2018, 5:01pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/15 "2018-06-01T17:01:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 2, 2018, 3:12am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/16 "2018-06-02T03:12:04Z")

</div>

Here is the new link for the larger file. [https://drive.google.com/open?id=1MRXSHdZD119PInm4m782sNtyy49HY82R](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.

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [June 2, 2018, 11:05pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/17 "2018-06-02T23:05:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 2, 2018, 11:20pm UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/18 "2018-06-02T23:20:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shardfall](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shardfall](https://forums.unrealengine.com/u/shardfall)\
**Post date:** [June 3, 2018, 12:16am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/19 "2018-06-03T00:16:15Z")

</div>

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](https://drive.google.com/file/d/15IQFQQ0xQ0bAtk9ubhAoQrnc2tKGNBMy/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![live4film](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@live4film](https://forums.unrealengine.com/u/live4film)\
**Post date:** [June 3, 2018, 6:08am UTC](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880/20 "2018-06-03T06:08:29Z")

</div>

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.

[Next page](https://forums.unrealengine.com/t/vr-interactivity-constraints/425880.md?page=2)
