Rotation Issues with VR

I simply want to make the arms rotate with the VR head.

I’ve tried doing this for a couple of hours, but when my VR player uses the built-in rotation functionality on VR their arms stay facing the same way but the head moves just fine.

local head = game:GetService("VRService"):GetUserCFrame(Enum.UserCFrame.Head) + camera.CFrame.Position
local right = game:GetService("VRService"):GetUserCFrame(Enum.UserCFrame.RightHand) + camera.CFrame.Position
local left = game:GetService("VRService"):GetUserCFrame(Enum.UserCFrame.LeftHand) + camera.CFrame.Position

camera.CFrame = head
arm1.CFrame = left
arm2.CFrame = right

Can you please tell me what I’m missing?

5 Likes

Pretty sure there is a safeguard so you cannot just edit the players CFrame, To prevent bad people from giving people motion sickness and such.

2 Likes

The issue is with the hands not the camera. Also I’ve tested it and there is no safeguard.

1 Like

My VR headset broke recently, So I cannot really help you troubleshoot this problem, Sorry.

From what I see, I don’t think you can just add CFrames together, The only reason the head “works”, Is because if you have VR support enabled, The camera and head are welded together.

2 Likes

I’m not adding CFrames, I’m adding a Vector3 to a CFrame which offsets the position.

1 Like

You are adding CFrames to each other. Read your code again.

2 Likes

It is CFrame + Vector3 not CFrame + Cframe

1 Like

Don’t see a vector3 in here.

You are adding a Cframe grabbed from VRService ontop of the camera’s cframe.

Another reason would be that you have to do this EVERY time a frame is rendered as the CFrames get overwritten every renderstepped.

CFrame.Position is a Vector3…

Here’s the documentation

Correct, but this Vector3 does not act as a offset. Atleast not how you are applying it.

That is invalid

local cframe = CFrame.new(Vector3.new(10,50,10), Vector3.new(0,10,25))
print(cframe) -- 10, 50, 10, -0.832050323, -0.505711615, 0.227921158, -1.49011612e-08, 0.410890698, 0.911684632, -0.554700196, 0.758567512, -0.341881752
cframe = cframe + Vector3.new(10,10,10)
print(cframe) -- 20, 60, 20, -0.832050323, -0.505711615, 0.227921158, -1.49011612e-08, 0.410890698, 0.911684632, -0.554700196, 0.758567512, -0.341881752