# VR Expansion Plugin

**URL:** <https://forums.unrealengine.com/t/vr-expansion-plugin/68709>\
**Category:** XR Development\
**Tags:** unreal-engine\
**Created:** [July 11, 2016, 6:16pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709 "2016-07-11T18:16:57Z")\
**Posts on this page:** 20\
**Page:** 23

<div class="post-metadata">

**Author:** ![anonymous\_user\_601851e1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_601851e1](https://forums.unrealengine.com/u/anonymous_user_601851e1)\
**Post date:** [December 29, 2016, 4:36am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/452 "2016-12-29T04:36:39Z")

</div>

> [@;643698](#):
>
> The object has to be marked as always relevant or replicated, does the client even see the object?

The object is set to always relevant and replicates.

The server is still the only one seeing it gripped

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [December 29, 2016, 5:13am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/453 "2016-12-29T05:13:19Z")

</div>

> [@Shanowzer;643703](#):
>
> The object is set to always relevant and replicates.
> 
> The server is still the only one seeing it gripped

Well not much more I can tell you unless you look in the logs for error messages, because it doesn’t have that problem even in the template which is unfinished for multiplayer so you are doing something weird.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_601851e1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_601851e1](https://forums.unrealengine.com/u/anonymous_user_601851e1)\
**Post date:** [December 29, 2016, 5:18am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/454 "2016-12-29T05:18:18Z")

</div>

> [@;643710](#):
>
> Well not much more I can tell you unless you look in the logs for error messages, because it doesn’t have that problem even in the template which is unfinished for multiplayer so you are doing something weird.

Closed and re opened project… works

Bug?

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [December 29, 2016, 6:01am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/455 "2016-12-29T06:01:10Z")

</div>

> [@Shanowzer;643712](#):
>
> Closed and re opened project… works
> 
> Bug?

Not likely to be with the plugin, that would be a BP problem.

---

<div class="post-metadata">

**Author:** ![EspireMike](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/espiremike/32/1155389_2.png) [@EspireMike](https://forums.unrealengine.com/u/EspireMike)\
**Post date:** [December 29, 2016, 11:28pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/456 "2016-12-29T23:28:05Z")

</div>

Hey !

Hope you are enjoying the holidays! I had 2 questions I was hoping to get some advice on!

**Question 1 - Spawning objects in the player’s hand, already gripped**  
Explanation: In your Template the player has a “body” cylinder that the potion can be stored in.  
I am hoping to have functionality where:  
-Player puts hand ‘inside’ the body cylinder  
-Player presses the grab button  
-The potion is spawned at the player’s hand and the player is now gripping the potion

I was wondering the best way to implement .  
Should the body cylinder be a standard actor that uses the VRGripInterface, deny gripping, but “onGrip” check to see if it is the player’s controller? If so, spawn potion and attach to player’s hand?

\*\*Question 2 - fire event every time player grabs a ‘grippable box’. \*\*  
Explanation: In your template there is the Gun with a ‘grippable box’ that can be moved on one axis.  
I want to play a sound every time the grippable box is ‘gripped’.  
How would be the best way to do that?

Do I have a branch on the “On child grip” event that checks if the child was the gripabble box, if so -\> play sound ?

As an extension - If there happen to be many components on an actor that can be “Child gripped”, should we set up an ‘on child grip’ with a few branches for each of the child components? Or is there a better way to do ?

Thanks for any advice. Love the plugin, it’s the best 🙂

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [December 30, 2016, 7:59pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/457 "2016-12-30T19:59:03Z")

</div>

> [@michaelwbell;644001](#):
>
> Hey !
> 
> Hope you are enjoying the holidays! I had 2 questions I was hoping to get some advice on!
> 
> **Question 1 - Spawning objects in the player’s hand, already gripped**  
> Explanation: In your Template the player has a “body” cylinder that the potion can be stored in.  
> I am hoping to have functionality where:  
> -Player puts hand ‘inside’ the body cylinder  
> -Player presses the grab button  
> -The potion is spawned at the player’s hand and the player is now gripping the potion
> 
> I was wondering the best way to implement .  
> Should the body cylinder be a standard actor that uses the VRGripInterface, deny gripping, but “onGrip” check to see if it is the player’s controller? If so, spawn potion and attach to player’s hand?
> 
> **No I would just have the trigger event branch at where it detects the object and if it is an “Inventory object” use different logic. Deny gripping totally denies attempting to grip at all and it will fail out. Making an enum of “BaseObjectTypes” and branching the trigger logic based on which base it is would likely be best. It also future proofs it for when you want to do more custom logic like climbing or special actions that don’t involve gripping.**
> 
> \*\*Question 2 - fire event every time player grabs a ‘grippable box’. \*\*  
> Explanation: In your template there is the Gun with a ‘grippable box’ that can be moved on one axis.  
> I want to play a sound every time the grippable box is ‘gripped’.  
> How would be the best way to do that?
> 
> Do I have a branch on the “On child grip” event that checks if the child was the gripabble box, if so -\> play sound ?
> 
> As an extension - If there happen to be many components on an actor that can be “Child gripped”, should we set up an ‘on child grip’ with a few branches for each of the child components? Or is there a better way to do ?  
> \*\*  
> You can actually subclass the grippable component and do it “OnGrip” in that if it makes more sense to you. The Child gripped event is a convenience but things like that would likely be better done in the component itself.\*\*
> 
> Thanks for any advice. Love the plugin, it’s the best 🙂

Replies in bold in the quote.

I have been writing down things I want to do next week all week (ended up being at work over my vacation a bit \>.\< and my son was sick). Should be more than free over the next few days, I want to look over multiplayer logic some more and try and streamline it.

---

<div class="post-metadata">

**Author:** ![UE4Hobbyist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UE4Hobbyist](https://forums.unrealengine.com/u/UE4Hobbyist)\
**Post date:** [December 31, 2016, 6:53pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/458 "2016-12-31T18:53:17Z")

</div>

> [@;643482](#):
>
> No, if the object is already replicated my plugin checks the array of held objects when it is updated over the network and if it finds a new grip (like if connecting in) then it sets up the grip.
> 
> Your issue with instantly spawning and calling grip is that the array of gripped items is probably sent before the actual object is sent over so the client can’t actually grip anything.
> 
> _Edit_ I could technically add a flag and check held items for if they have been processed yet every frame but I think gripping after the replication is better (or spawning the object client side instead for things that don’t need to be server side, generally side arms and the like won’t need to be).

Is there any work around for multiplayer games that need the player to spawn with objects already held? E.g. in most multiplayer fps shooters the player respawns with a gun held.

---

<div class="post-metadata">

**Author:** ![maki-san](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maki-san](https://forums.unrealengine.com/u/maki-san)\
**Post date:** [December 31, 2016, 8:58pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/459 "2016-12-31T20:58:50Z")

</div>

![ErrorVRPLugin1.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/d/e4df01a01a84f7dc704e3dcc5a9bc780e94a4c3b.png)

Do you know what error is? Should I be concerned?

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 1, 2017, 3:50pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/460 "2017-01-01T15:50:46Z")

</div>

> [@UE4Hobbyist;644615](#):
>
> Is there any work around for multiplayer games that need the player to spawn with objects already held? E.g. in most multiplayer fps shooters the player respawns with a gun held.

I mean you can just make sure the item is replicated over first, the main issue is that currently gripping is server authoritative to regulate actions. Calling the grip on client side adds to the currently gripped array which is replicated down from the server.

I have some ideas of improvements to make on my todo list, maybe i’ll add a secondary gripped array that doesn’t replicate so you can run some logic fully locally. The reason the main array is replicated by the server is to prevent multiple players trying to grip the same thing at the same time and locally picking it up when someone else holds it.

Hmm, in fact i’ll probably just do that, add a secondary grip array that only acts locally, could just merge them before processing then. Then you could spawn props locally and grip them in a multiplayer enviroment.

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 1, 2017, 3:51pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/461 "2017-01-01T15:51:19Z")

</div>

> [@maki-san;644634](#):
>
> ![ErrorVRPLugin1.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/d/e4df01a01a84f7dc704e3dcc5a9bc780e94a4c3b.png)
> 
> Do you know what error is? Should I be concerned?

Yeah thats an editor issue, I don’t remember what causes it, you’ll want to check answerhub.

---

<div class="post-metadata">

**Author:** ![UE4Hobbyist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UE4Hobbyist](https://forums.unrealengine.com/u/UE4Hobbyist)\
**Post date:** [January 1, 2017, 4:50pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/462 "2017-01-01T16:50:59Z")

</div>

> [@;644786](#):
>
> I mean you can just make sure the item is replicated over first, the main issue is that currently gripping is server authoritative to regulate actions. Calling the grip on client side adds to the currently gripped array which is replicated down from the server.
> 
> I have some ideas of improvements to make on my todo list, maybe i’ll add a secondary gripped array that doesn’t replicate so you can run some logic fully locally. The reason the main array is replicated by the server is to prevent multiple players trying to grip the same thing at the same time and locally picking it up when someone else holds it.
> 
> Hmm, in fact i’ll probably just do that, add a secondary grip array that only acts locally, could just merge them before processing then. Then you could spawn props locally and grip them in a multiplayer enviroment.

A mixed aproach by allowing local grabbing sounds great. By using a rep notify actor variable each client can perform the grab locally when that actor finally gets replicated.

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 1, 2017, 8:23pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/463 "2017-01-01T20:23:34Z")

</div>

> [@UE4Hobbyist;644800](#):
>
> A mixed aproach by allowing local grabbing sounds great. By using a rep notify actor variable each client can perform the grab locally when that actor finally gets replicated.

I’ll start working on that tomorrow

---

<div class="post-metadata">

**Author:** ![lenne0815](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lenne0815](https://forums.unrealengine.com/u/lenne0815)\
**Post date:** [January 1, 2017, 11:44pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/464 "2017-01-01T23:44:38Z")

</div>

Hey Mordreal, first of all many many thanks for Plugin !

I unfortunately have a hard time compiling it though, no matter what i try i always end up getting these errors:

1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C2143: Syntaxfehler: Es fehlt “;” vor “_"  
1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: “default-int” wird von C++ nicht unterstützt.  
1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C2238: Unerwartete(s) Token vor “;”  
1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C2143: Syntaxfehler: Es fehlt “;” vor "_”  
1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: “default-int” wird von C++ nicht unterstützt.  
1\>C:\Users est1\Documents\Unreal Projects\MyProject\Plugins\VRExpansionPlugin\Source\VRExpansionPlugin\Public\SimpleChar/VRSimpleCharacter.h(68): error C2238: Unerwartete(s) Token vor “;”  
1\>ERROR : UBT error : Failed to produce item: C:\Users est1\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-2231.dll

It might be something really simple but i just cant figure it out, im trying for 3 days now and just cant find a solution ☹

---

<div class="post-metadata">

**Author:** ![MagicBots](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MagicBots](https://forums.unrealengine.com/u/MagicBots)\
**Post date:** [January 2, 2017, 7:03am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/465 "2017-01-02T07:03:10Z")

</div>

Hi, I noticed that the teleport function only seems to be working from the listen server machine, and not from client only machines.  
On client only I’m always teleported to the origin.

Just checking if is expected behavior for the current state of the template before I try to fix it.  
( I’m working on a modified copy of the template from 11-30-2016 )

Update: Fixed. was something broken only in my copy of the template. Issue due to an insufficient navmesh.

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 2, 2017, 7:06pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/466 "2017-01-02T19:06:00Z")

</div>

> [@alltrueist;645005](#):
>
> Hi, I noticed that the teleport function only seems to be working from the listen server machine, and not from client only machines.  
> On client only I’m always teleported to the origin.
> 
> Just checking if is expected behavior for the current state of the template before I try to fix it.  
> ( I’m working on a modified copy of the template from 11-30-2016 )

I tested as client in a listen server and teleport worked fine, however I did redo some of the teleport stuff since then I think.

> [@lenne0815;644908](#):
>
> Hey Mordreal, first of all many many thanks for Plugin !
> 
> I unfortunately have a hard time compiling it though, no matter what i try i always end up getting these errors:
> 
> _snip_
> 
> It might be something really simple but i just cant figure it out, im trying for 3 days now and just cant find a solution ☹

Hmm your project isn’t picking up the replicated camera as a valid type.

I’ll add  
#include “ReplicatedVRCameraComponent.h”

after  
#include “ParentRelativeAttachmentComponent.h”

In the header to ensure that it compiles it but it shouldn’t be required.

---

<div class="post-metadata">

**Author:** ![lenne0815](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lenne0815](https://forums.unrealengine.com/u/lenne0815)\
**Post date:** [January 2, 2017, 7:15pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/467 "2017-01-02T19:15:50Z")

</div>

Thank you very much for your reply, im really out of my depth on one, im unfortunately not even sure if it really doesnt work or if i misjudged it.

error is thrown while compiling when i go to add new / add c++ / show all / vrsimplecharacter - in that case building fails with the mentioned error. if i just add it via place it turns up and seems to be working correctly now ( it adds the camera and the sphere and i can spawn the vr preview there even though the motion controller do nothing at the moment but i suspect that might fix itself once i watched your videos )

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 3, 2017, 1:42am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/468 "2017-01-03T01:42:22Z")

</div>

I fully converted the plugin over to being UObject based today instead of Actor/Component. It was a long time coming after I made the generic uobject grip nodes.

I will need to test it for awhile due to how much was changed for it, hopefully I will have a new build out tomorrow with some improvements, that change, and the local only sided gripping.

When I push it live it WILL require some node changes, I held back on change for so long because it will require revisions to already working functions, but the plugin is better off with the change made.

---

<div class="post-metadata">

**Author:** ![thomja](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thomja](https://forums.unrealengine.com/u/thomja)\
**Post date:** [January 3, 2017, 6:05pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/470 "2017-01-03T18:05:38Z")

</div>

Hey

I still haven’t managed to get the small box working.

I have imported the GunBase from your project and didn’t change a thing and it just didn’t work. Not even sure where to begin troubleshooting.

Here is a video of it: [- YouTube](https://www.youtube.com/watch?v=TfvAXRsuqnQ)

---

<div class="post-metadata">

**Author:** ![mordentral](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mordentral](https://forums.unrealengine.com/u/mordentral)\
**Post date:** [January 4, 2017, 12:34am UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/471 "2017-01-04T00:34:59Z")

</div>

> [@thomja;645556](#):
>
> Hey
> 
> I still haven’t managed to get the small box working.
> 
> I have imported the GunBase from your project and didn’t change a thing and it just didn’t work. Not even sure where to begin troubleshooting.
> 
> Here is a video of it: [https://www.youtube.com/watch?v=TfvAXRsuqnQ](https://www.youtube.com/watch?v=TfvAXRsuqnQ)

Is it even attempting to grip it? the likely cause is in the gripping nodes for your character. You can pull a true/false out of the GripObject node and if it fails it will also print to the log why it failed.

First things first I would break on grip object if the passed in object to grip is a component and see if it ever triggers.

---

<div class="post-metadata">

**Author:** ![EspireMike](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/espiremike/32/1155389_2.png) [@EspireMike](https://forums.unrealengine.com/u/EspireMike)\
**Post date:** [January 4, 2017, 8:53pm UTC](https://forums.unrealengine.com/t/vr-expansion-plugin/68709/472 "2017-01-04T20:53:06Z")

</div>

> [@;645297](#):
>
> I fully converted the plugin over to being UObject based today instead of Actor/Component. It was a long time coming after I made the generic uobject grip nodes.

Very exciting!

[Previous page](https://forums.unrealengine.com/t/vr-expansion-plugin/68709.md?page=22)

[Next page](https://forums.unrealengine.com/t/vr-expansion-plugin/68709.md?page=24)
