-
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. -
What is the issue?
(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? -
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.)