How do I calculate where the foot should be placed?

I am trying to create an active ragdoll like GTA and Max Payne but the legs are really buggy. How do I calculate where the foot should be placed based on the movement on the character.

This isn’t the full script but, it’s basically how I tried to calculate the foot position for One Foot. Lik = IKControl

Force = rootPart.Velocity * Vector3.new(1,0,1)
	if Force.Magnitude > 0.001 then
		Direction = Force.Unit	
	end
local ray = Ray.new(rootPart.Position, ((rootPart.Position + (Direction * 5)) * Vector3.new(0,-.1,0)).unit*10)
		local hit, pos, norm, mat = game.Workspace:FindPartOnRayWithIgnoreList(ray, {char})
		if hit then
			--print(hit.Parent)
			local attach = Instance.new("Part")
			attach.CanCollide = false
			attach.Parent = workspace
			attach.Anchored = true 

Lik.EndEffector = char.LeftFoot
					Lik.ChainRoot = char.LeftUpperLeg
					Lik.Target = attach


footpos = pos

Maybe this could help you:

1 Like