x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Weapon Holster VR

Hi, I'm currently working on a VR project and have a weapon and magazines which the player can pick up and interact with. However, I have now come to create Weapon Holsters, which will be attached around the players waist and will allow the player to drop their weapons in. The issue I'm having is keeping the holsters location relative to the player, so that when they turn and move, the Holsters will always stay in the same place at their waist.

I had a play around and managed to get the holsters in the right place by finding the cameras world location and offsetting the Y and Z values, however, as the player rotates, the holsters do not rotate with them. So a holster that started out on the left side of the players hip ends up in front or to the right of the player.

I thought about using the Forward Vector, but when I use that, the holster disappears completely and I think its moving with the camera so that the player can never quite see it.

Any help explaining how to do this would be greatly appreciated

Product Version: UE 4.21
Tags:
more ▼

asked Jan 10 '19 at 06:14 PM in Blueprint Scripting

avatar image

M_Forshaw
1 1 2

avatar image Nebula Games Inc Jan 10 '19 at 07:32 PM

What is the component hierarchy in your actor BP? If everything is parented properly your actor should rotate as a whole unless you have some nodes that are adding local rotation.

avatar image M_Forshaw Jan 10 '19 at 08:21 PM

The holsters are attached to my Camera Root, along with the Camera. On event tick, I get the location of the camera and offset the Y & Z in order to get it where I want it. I am aware that the issue lies with how I'm setting the location, as the camera will rotate, making the axis change and therefore Y & Z will not carry with the camera. This is why I tried Forward vector but that didn't! work either although its likely I did it wrong. This is what I'm trying to find out about alt text

capture.jpg (134.8 kB)
avatar image Nebula Games Inc Jan 10 '19 at 08:33 PM

Why aren't you simply rotating the camera root. In the viewport offset each holster where you want and they should maintain the relative location during all transform operations of the camera root.

avatar image M_Forshaw Jan 10 '19 at 08:37 PM

I have tried that, the issue I get then is that the Holsters follow the camera, so when I look down to interact with them, they rotate with the camera, meaning they will always be out of my view

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

So un-parent the holsters from the camera then because you will always end up with that issue. Allow the camera root to move the camera, have a "holster root" that you also rotate with the camera root for all yaw inputs but when it comes to pitch break the rotator and don't allow pitch input, this way when you look up the holsters will be out of sight like a normal person looking up, but when you look down they will be right there. Yaw movements will be fine as they follow the camera left and right just as a human waist would follow during a turn.

more ▼

answered Jan 10 '19 at 08:42 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image M_Forshaw Jan 10 '19 at 08:54 PM

Sorry, I dont understand what you mean. I've had a similar issue with other articles I've found touching this issue, would you be able to explain more in depth how to do that if possible please?

I have a Holster root now that my holsters are parented to. Should this Holster Root be parented to the Camera root and in my event graph, how should I set it out?

avatar image M_Forshaw Jan 10 '19 at 09:07 PM

Actually, I figure it out and it works perfectly! thankyou man, been searching for this for days!

avatar image Nebula Games Inc Jan 10 '19 at 09:18 PM

Haha I'm glad it works.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question