VR Weapons Kit

I’ve had a look online and according to this Reddit post describing the same issue accessing the OculusFunctionLibrary on MacOS - apparently the only way to access the OculusVR plugin’s features is by sideloading Windows on their machine and using that for development. However, you may be able to get around that just by removing any functions or nodes that reference the function library, such as the CheckDevice function or the Set Color Scale Offset node. That should hopefully resolve compiler errors and allow you to access most of the kit’s functionality.

The handgun uses the exact same code as the SMG and assault rifle for pulling back the charging handle/slide, they all use the code that exists in their parent blueprint (BP_gun), the only difference is the handgun has some additional functionality to realign the barrel tilt. Please can you try deleting both the event tick node and parent tick node to see if this section of code in BP_handgun is causing the issue when cocking the slide?

Okay so i started with a fresh new project and followed the below steps:

  1. Delete the CheckDevice node and change it to a boolean with a value of TRUE (to signify always true for Oculus Quest)
  2. Then I delete the Set scale and offset functions referencing the Oculus VR plugin and replace it with a new custom function which is similar. This was located in 3 places in the code.

With those steps the sliding action works perfectly for all the guns including the handgun and sniper rifle. Also the hand animations work perfectly as well.

The only issue I have now is that the player damage isn’t working. I see blood and red when my player gets shot but the screen never turns black to signify death. (I’m assuming this is because we deleted the set scale and offset functions).

I just need to know how to recreate the player damage/death part of the code without having to use the Oculus VR set scale and offset functions.

That’s great, I’m glad we could make progress with this.

Okay, the Oculus Quest is limited with these sorts of screen effects, Mobile HDR is turned off (for performance) which means you can’t use any post-process effects and because you can’t access the OculusVR functions library I think the only option will be darkening the screen using the Screen flash widget inside MotionControllerPawn. This is how the flashbang creates the flash blinding effect on Quest.

Here’s how you could set this up:

Go to the global folder and open FlashbangWidget. Then add a new border to the canvas. You can either use an image if you want a vignette effect or just change the brush colour to black.

Set the render opacity to 0

Go to MotionControllerPawn and create a variable for the widget

Open the Damage function

Modify it to look like this

Open the Regenerate health graph

Modify it to look like this

Hopefully this will help you simulate damage through the widget

Thanks! I was able to get the player damage working by following those steps.
I also recompiled the player damage code which was giving a warning ( located in the enemy character blueprint → ‘shoot weapon’ section → player damage → press recompile)
So, just for your reference below are the steps i took from a brand new project to get everything working.

MotionControllerPawn

  1. Remove checkDevice and wire condition branch to True
  2. Remove the color scale offset functions
  3. Rewire the update/exec wire connections from the removed functions
  4. follow the steps you provided above
  5. compile

Enemy character

  1. Under shoot weapon click on the player damage function
  2. Compile to fix errors

Thanks a lot for all of your help! I really like this kit!!!

That’s great, we got there in the end! I’m very sorry you had these issues getting it working on iMac, I’m using Windows machines so it was the only platform I could test on. Thanks for the breakdown of your steps. Let me know if you need any help in the future and please leave a review if you get a chance.

Thanks!

hello!

i am running into this issue:

LogPlayLevel: Error: 12-21 01:58:44.750 3771 3800 D UE4 : [2020.12.21-07.58.44:750] 0]LogStreaming: Error: Couldn’t find file for package /Script/SteamVR requested by async loading code. NameToLoad: /Script/SteamVR
LogPlayLevel: Error: 12-21 01:58:44.750 3771 3800 D UE4 : [2020.12.21-07.58.44:750] 0]LogStreaming: Error: Found 1 dependent packages…
LogPlayLevel: Error: 12-21 01:58:44.750 3771 3800 D UE4 : [2020.12.21-07.58.44:750] 0]LogStreaming: Error: /Game/VR_Weapons/Pawn/Blueprints/BP_MotionController

any idea of what may i be doing wrong? plugin enabled, steam vr installed, oculus configured as suggested in

https://developer.oculus.com/documentation/unreal/unreal-quick-start-guide-quest/

also added the fix rate you suggested in the docs. the initial startup map worked but no movement was possible. i then configured the full demo map to be the starting one. this one is the one crashing. any ideas?

thanks!

cheers,

Hello @esaavedra76

Sorry for the delayed response.

Which version of UE4 are you working with? and are you testing on Oculus Quest?

Thanks

hi @xadamxful i’m using 4.26 and using the oculus quest 2 yes

@esaavedra76 The kit is not yet supported in 4.26 only **4.25 **for now

I am working on updating it at the moment, I am also getting the same error messages as you on Oculus Quest - to get around this temporarily in 4.26 I just deleted the SteamVRChaperone component in BP_MotionController + any of the associated nodes and disconnected the SetupRoomScaleOutline function after event begin play.

This lets me launch but It still crashes which strangely seems to be caused by **print string **nodes! It will crash instantly in the demo maps because there is a console command in the level blueprint that prints text to the screen for performance debugging

Level Blueprint console command.PNG

If this is disconnected, it will let the level open but it will crash as soon as you start interacting with weapons because of all the print strings. Apart from removing each print string node the only other way I could get it working was to package the project with shipping configuration and use an arm64 build (by checking “support arm64” in Android build settings)

A bug report has been submitted and there is an Answerhub post here that might have more info in the future.

I’ll try to get this sorted ASAP so I can release a working 4.26 version

hi @xadamxful thanks for the info!!! i’ll attempt to get it working with your instructions until the 4.26 is supported. thanks!

Having issue; 4.25, I can grip anything but the guns. Works fine with default project.
Gun blueprints all show “bad blueprint” in viewport. I’ve attempted to replace the assets multiple times, nothing.
When I grip the model with Oculus Touch, I get the haptic feedback, but it doesn’t pick up the gun. I can still pick up magazines and blocks ,even
attach suppressors to the gun models.
Gun blueprints have no compilation errors.

Hi @DeathTempler, if you have checked the gun blueprints but it is still showing “bad blueprint” in the level, please could you navigate to *VR_Weapons/Global/Blueprints/BP_Gun *and also check the master gun blueprint for compiler errors.

I’m now getting a whole lot of “AutoCreateRefTerm Expansion: Assignment Error”
as well as “Input pin non-default value no longer exists on node”.
All this under BP_Gun

Refreshing all the nodes fixed it!
However, while I can now pick up all actors, I can’t insert magazines into guns. Pretty sure this just needs some input changes, if not I’ll post again. Thanks for the assistance!

Could you check the magazine’s insert collision box is set to overlap the “magazine” object type in the collision settings

and also the magazine well collision box for each gun is set to overlap “magazine” object types.

I’m on my phone at the moment but I can send screenshots when I’m at my computer i if that would help.

It would be appreciated. Aside from that, is there any way to add locomotion? I have it working with my another character blueprint, but it won’t work with the one from this pack.
Teleportation doesn’t work outside the pack’s levels.

Here are the collision settings for guns & magazines, hopefully this might fix the problem for you if these need changing:

How are you trying to implement locomotion? Could I see a screenshot of your blueprint graph? I haven’t looked at locomotion yet for this project, but it is something I will definitely be adding along with other features soon.

Teleportation should work on other levels, If you create a new level, then add a nav mesh to the ground & the Motion Controller Pawn - what result do you get when you try to teleport? Does it just show the teleportation stub or do you get nothing?

Hello xadamxful,

This is a fantastic Kit, I have successfully integrated my own handgun and it is working great (Oculus Quest 2- UE 4.25).

I see that you are planning some updates for the pack and I will like to make a small “wish list” with a few things (that you probably have in mind already…) that I do believe would make it just perfect:

1- Possibility to add a custom hand pose per weapon for Slide movement (cocking action) so the left-hand attaches to the weapon slide in a more immersive manner. Would be great also that after grabbing this part, the hand stays locked to the slide until you decide to release the grab button. The current approach makes cocking the weapons a bit “tricky” (same for handgun support hand).

2- Bullet release after cocking, and removal of that bullet from the mag counter every time you ■■■■ with one in the chamber.

3- Belt or Vest attach system to leave/lock the mags and weapons. Seems a lot more immersive to me than the current inventory system.

4- While aiming with 2 handed weapons, the possibility to add rotation in the axis that remains locked for secondary hand, so you can aim in a degree that does not force to be straight.

5- Frag grenade addition? :]

6- For bolt action rifles, the ability to continue grabbing with second hand and release pistol grip in primary hand so blot can be operated in the right way with the right hand. (also adding custom hand pose and grab until released).

7- The “solution” for left-handed persons is not really convenient, as it just flips the whole weapon geometry in one axis. Which results in a very unrealistic approach. Maybe you could do something about it in the future?

I hope some of these suggestions will fit in your road map for this pack.

Also, could you please add your Oculus Quest UE4 project to the downloadable files?

Thanks for all the hard work so far, very happy with the purchase.

Best!

Grajo

I don’t see “Magazine” under object type for the magazine or gun.

That’s strange, you should have an object channel in the collision settings called “magazine”. If you don’t please can you add it:

That fixed it : )

As for movement, yeah I’m getting teleport stub. I ended up removing TP outright since it won’t play right in my game. My BP for locomotion isn’t working, however the BP for rotation was, despite the rotation being constant for some reason.