Movement not relative to the position (rotation) of the camera

  1. What do you want to achieve? Keep it simple and clear!
    I want the movement to be relative to the camera.

  2. What is the issue? Include screenshots / videos if possible!
    The movement becomes very buggy when you look around. (This doesn’t happen in non-vr mode)
    https://cdn.discordapp.com/attachments/1123191646880809061/1184879596970192956/com.roblox.client-20231214-162503.mp4

You can see the actual position of the thumbstick on the semi-transparent controller model.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked but didn’t find anything.

This is the code for the vr camera (showing that the code for non-vr and vr is almost 1:1 except a few changes)

if VRService.VREnabled and VRService:GetUserCFrameEnabled(Enum.UserCFrame.Head) then
	local vrHeadPosition = VRService:GetUserCFrame(Enum.UserCFrame.Head)
	local y, x, z = vrHeadPosition:ToOrientation()

	main.ax = math.deg(x)
	main.ay = math.deg(y)
else
	main.ax = (number)
	main.ay = (number)
end