Hi, so, I’m making a shooting game and I wanted the player to bend their torso towards the camera. So, I used a YouTube video about IK (Inverse Kinematics) to bend my torso towards the camera.
For some reason, I expect the IK to give up when attempting to look behind the player, but the IK never stops to look behind the player:
The video explained that the IK control’s weight is 0.999 so that the IK gives up when looking behind the player, but it’s not happening in the video above.
This is some part of the script that I suspect to be the problem:
function CharAdded(Char)
task.wait()
local ik = Instance.new("IKControl")
ik.Type = Enum.IKControlType.LookAt
ik.ChainRoot = Char.UpperTorso
ik.EndEffector = Char.Head
ik.Target = parts[game.Players:GetPlayerFromCharacter(Char)]
ik.Weight = 0.999
ik.Parent = Char.Humanoid
Char.Humanoid.Died:Once(function() ik:Destroy() end)
end
function PlayerAdded(plr)
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
part.Transparency = 1
part.Parent = workspace
parts[plr] = part
if plr.Character ~= nil then CharAdded(plr.Character) end
plr.CharacterAdded:Connect(CharAdded)
end
Any help is appriciated .