I’m making a first person VR game, and I need to be able to move forward where ever I’m looking. Is there any way I would be able to do this?
The camera has a CFrame
property. CFrames are matrices with a position and direction. CFrames also have a LookVector
property which defines the direction which the CFrame is facing.
https://developer.roblox.com/en-us/api-reference/datatype/CFrame
You can also construct a CFrame using the CFrame.new(origin, direction)
overload of the function.
So, in all:
Just change the CFrame of the HumanoidRootPart
or whatever character you want to “move” to be its current position with the direction of the camera.
myPosition = CFrame.new(myPosition, cameraDirection)
1 Like