Need help trying to get gun holster to stay stationaryin VR game

Hello everyone!

I’m making a Gun based VR game and essentially I have two guns that will be in holsters on the sides of the VR character, The problem is that so far I haven’t had any luck keeping them in place. I’ve tried parenting them to the head but they rotate with the head.

What I’m trying to accomplish is that they stay on a camera rig so the character can look down and see the guns in place no matter where he moves his head. Any Ideas on how I can do this, I know its super easy and I’m missing it.

1 Answer

1

Try these code, it works for me.

    public Transform cameraTransform;

void Update()
{
	Vector3 newForward = cameraTransform.forward;
	newForward.y = 0;
	transform.position = cameraTransform.position;
	transform.forward = newForward;
}

I am doing something similar as well. I am having hard time finding a holster model, can you tell me where you got them from? I couldn't find any on asset store