VR Movement Issue

So currently I have a working basic VR setup which includes head and hands movement depending on the controller. This also replicates to the rest of the server. I want a movement system to where ever you are facing you press the trigger (ButtonR2) and you are pushed forward for however long you are pushing the trigger(pretty much a freecam). The issue I have ran into was the actual movement of your VR camera. The only way I see to move it was using VRService:RequestNavigation but this would be too choppy when you would be moving forward. What are other ways you can move the VR camera in the world other than VRService:RequestNavigation?

I am not asking for an entire section of code. I am asking for ways to move the VR camera around.

Any help or suggestions are appreciated!

1 Like

What kind of setup is this? If I recall correctly, you should be able to just move the camera forwards every frame with toWorldSpace and a really small CFrame.

1 Like

The setup is just a head that tracks CFrame movements and places the head in the location based on where that CFrame is. Same with the hands. Is there a wiki explaining toWorldSpace?

I can’t test anything right now as my batteries are dead.

1 Like

Scroll down to Dynamic CFrame Orientation on this page:

That’s probably the best explanation there is of it.

1 Like

Does this work with the VR camera or the camera in workspace? Those seem to be two different things in studio

1 Like

What? There’s only one camera object at any given time, unless they changed it. workspace.CurrentCamera and workspace.Camera are the same thing, if that’s where the confusion lies.

Previously when I had changed the parent of the camera, the VR view didn’t change. It stayed in the same spot. Not sure if something was wrong or if I didn’t do something right.

Why would you change the parent of it?

Meant subject** my bad
30 chars

I’m 99% sure that the camera stays locked relative to the player’s headset view, and that you can’t really change the subject of it; however, you can manipulate the CFrame of it to, say, move it forwards.

I may or may not come back with a question, but thanks for clearing up the confusion.

Sure thing! I’ve dealt with VR setups before, so if you have any questions, just reply again and I’ll see if I can help.

Here’s what I do:

I make a point of origin, say a block, that the camera is set over. Not the VR camera- the camera object in workspace for each player.

Every render step i set the camera over it.

When the player uses an input to move forward (or sideways, or whatever) I simply move that block. The camera follows it, and the vr point of view follows, simulating movement.

You can test what I’ve made here:

(very scuffed/ proof of concept)
( :warning:DONT POINT AT AND CLICK THE OUTPUT :warning: you instantly crash)


I found an issue with using toWorldSpace. When I call the camera to move forward (using x or z), it re-orientates it to where it no longer is straight on the baseplate. I am looking for something that keeps the current orientation but changes the x,y, or z based on what direction is forward. I have seen LookVector being used to similar goals. Is there a way I can use LookVector?

Edit: A combination of LookVector and toWorldSpace did the trick. Here’s what I did if anyone was interested. Note: The head’s LookVector had to be used because the camera’s CFrame didn’t update. The head’s CFrame was already being updated on UserCFrameChanged.

	if R2trig then -- When true, the right trigger is being pressed (Oculus Touch)
		local offsetCFrame = CFrame.new(Head.CFrame.LookVector)
		camera.CFrame = camera.CFrame:ToWorldSpace(offsetCFrame)

Interesting. I don’t know what the problem could’ve been lol, usually CFrame:ToWorldSpace(CFrame.new(0,0,0.1)) or whatever works for me just fine. Good to see that you got it working though.

I have another question. I want the VR player’s head to match their actual avatar’s head. Everything I have tried so far, from HumanoidDescriptions to cloning the head, all failed. How do you get a copy of a player’s head and scale it up with all accessories(only things that attach to the head) still attached to the head correctly without 50 lines of code?

You know, I’m not quite sure, sorry. I’ve only dealt with normal sized Humanoids in VR… dunno what to say, you might just have to write a bunch of scaling code.

Alright sounds good. Thanks anyways.