I am trying to make a VR sandbox game, with one of the features being picking up items from the ground.
The further the hands become from (seemingly) the HumanoidRootPart, the less they follow my actual hands, making it impossible to touch the floor.
Currently I am simply making the player have magnetic hands and causing items on the floor to be picked up when reached for, but it is not what I want. I have also tried making the hands separate from the rig but it doesn’t seem to matter.
Sorry for the bad image, but here’s what I mean. You can see the hand is much closer to the player than the controller is reaching out. This effect only gradually takes place the further you reach and is not affected by head position, and it aligns perfectly when held close to the body.
I cannot get a video right now, but I’ll try to draw an example to show how it is.
The farther the controller goes from the center of the character the less the arm moves along with it until it does not move anymore.
The arm is not bound to the character in any way and is not affected relative to the headset/camera, as crouching down still gets the same issue.
The base CFrame acquired from :GetUserCFrame() seems to be the issue but I don’t know why it happens or what I can do to counter it.
Okay. The way you’re getting hand into the world cframe is correct, and will not give any broken cframes.
There is something wrong with how you are moving the arm to the hand. I couldn’t tell you why without seeing how you are moving the arm to the cframe unless you show some of the code for that.
Each hand is just a meshpart completely disconnected from the rig. It’s not clear in the picture but the arm connected to it fades out and is just an extension of the hand itself. There is no rigging involved.
Youre forgetting to multiply the position of the hands CFrame by the cameras headscale (Headscale basically makes everything look smaller or bigger in VR which can cause real world positions to be offset)
To multiply by the cameras headscale all you need to do is this
But now you need the rotation since that’s only getting the position
Hand.CFrame = (Camera.CFrame * CFrame.new(VR:GetUserCFrame(Enum.UserCFrame.LeftHand).Position * Camera.HeadScale)) * (CFrame.fromEulerAnglesXYZ(VR:GetUserCFrame(Enum.UserCFrame.LeftHand):ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(90), 0, 0)) -- I multiplied by 90 degrees to fix your offset, but you should fix the models rotation so you don't have to do this every time
That should fix the hands position being offset unless something else is affecting it. Either way, make sure to use the cameras headscale whenever you need to position something relative to the controllers or headset position. Hope this helps!