I have been working on a custom VR system for fun and am close, however I can’t seem to figure out a way to rotate the VR devices CFrame to match with the torso, in other words, the hands and head don’t rotate with the body. I’m not sure how to approach this problem either so any help would be awesome.
This is the function I’m using currently, and it works well for the positioning, but doesn’t do anything with orientation.
function updatehandpos()
if vr.VREnabled then
local righthandcframe = vr:GetUserCFrame(Enum.UserCFrame.RightHand)
local lefthandcframe = vr:GetUserCFrame(Enum.UserCFrame.LeftHand)
--getting cframe
local righthandpos = righthandcframe + character.Torso.Position + Vector3.new(0.5,1,0.2)
local lefthandpos = lefthandcframe + character.Torso.Position + Vector3.new(-0.5,1,0.2)
local headpos = vr:GetUserCFrame(Enum.UserCFrame.Head) + Vector3.new(0,2,0) + character.Torso.Position
--updating cframes via offsetting them to the torso
head.CFrame = headpos:ToWorldSpace(CFrame.new(0,0,0))
righthand.CFrame = righthandpos:ToWorldSpace(CFrame.new(0,0,0))
lefthand.CFrame = lefthandpos:ToWorldSpace(CFrame.new(0,0,0))
--updating hands
end
end