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
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.
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
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.
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
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?
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.