Need help with Inverse Kinematics for VR

  1. What do you want to achieve?
    Hi, I’m currently trying to create a VR system for use in my games. I’ve managed to make player hands position themselves according to the player’s controllers, however the player’s arms do not attach to the hands.
  2. What is the issue?
    image
    (ignore the right hand since I haven’t coded it yet, also this picture was not actually taken in VR but proves the same point) The left arm is trying to reach the left hand using inverse kinematics, but it isn’t actually long enough to get there. Does anybody know how I could handle this so that the arms don’t feel separated, but the player can still maintain the same amount of reach with their VR controllers?
  3. What solutions have you tried so far?
    I’m trying to use inverse kinematics to get the arms to follow the position of the hands, but I can’t figure out the best way to do this. I’ve looked on the devforum and at documentation, but can’t find anything understandable about inverse kinematics paired with VR. I tried using constraints earlier, but it was too confusing and I discovered inverse kinematics instead.
--code for setting up hands
local newRightHand = script.Parent:WaitForChild("RightHand")
local newLeftHand = script.Parent:WaitForChild("LeftHand")

newLeftHand.CanCollide = true
newRightHand.CollisionGroup = "Player"
newRightHand.CanCollide = true
newLeftHand.CollisionGroup = "Player"
newLeftHand.Anchored = true
newRightHand.Anchored = true
newRightHand.Name = "VRhandRight"
newLeftHand.Name = "VRhandLeft"
newRightHand.Parent = script.Parent
newLeftHand.Parent = script.Parent
newRightHand:FindFirstChild("RightWrist"):Destroy()
newLeftHand:FindFirstChild("LeftWrist"):Destroy()

--code for setting up inverse kinematics
local ikControl = Instance.new("IKControl")
ikControl.Type = Enum.IKControlType.Transform
ikControl.Target = newLeftHand:WaitForChild("LeftWristRigAttachment")
ikControl.EndEffector = script.Parent:FindFirstChild("LeftLowerArm"):FindFirstChild("LeftWristRigAttachment")
ikControl.ChainRoot = script.Parent:FindFirstChild("LeftUpperArm")
ikControl.Parent = script.Parent:FindFirstChild("Humanoid")

(I don’t make devforum posts often, sorry if there was anything I didn’t explain correctly. If anyone can help, I greatly appreciate it.)

1 Like

I managed to find a solution to this problem on my own; I used inverse kinematics, but rather than having the lower arm follow the hand, I made invisible duplicate hands which follow the VR controllers, and had the actual visible character’s hand use inverse kinematics to follow the other hand. It has limited range, but it works and the arm looks good from other player’s perspective. I’ll mark this as a solution for anybody looking for the answer to this problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.