SkinnedMesh footplant using IKControl

  1. What do you want to achieve?
    I want to make a foot-plant system on a skinned mesh using the new IKControl instance.
Image from Roblox's demo of IKControl

d6282e406d31ee902ed51e9ac574762fb00fdd58

  1. What is the issue?
    I just can’t figure out where to start. I’m really bad at math.
    I have a ray-cast setup to find the ground and all that but I don’t know how to make it look like the character is “walking”.

  2. What solutions have you tried so far?
    I’ve searched for a few days looking for people doing the similar thing but no one has except one person (and their post is unsolved).
    I’ve tried using code from other IK foot-plant scripts to achieve “walking” but I don’t understand any of the math and im not sure it will work.

Here is my code currently. It just find the ground and sticks the legs to the ground. Nothing complicated.

local character = script.Parent
local body = character.PrimaryPart

local moveDirection = Vector3.new()

local rlStart = body.RightLegStart
local llStart = body.LeftLegStart
local rlGround = body.RightLegGround
local llGround = body.LeftLegGround
local rlOffset = Vector3.new(0,0,0)
local llOffset = Vector3.new(0,0,0)

local castParams = RaycastParams.new()
castParams.FilterDescendantsInstances = {character}
castParams.FilterType = Enum.RaycastFilterType.Blacklist
castParams.IgnoreWater = true

local function moveLegs(dt) -- This doesn't work
	local dt10 = math.min(dt*10, 1)
	
	local rootVel = body.AssemblyLinearVelocity * Vector3.new(1,0,1)
	local rootVelMagnitude = rootVel.Magnitude
	local relativizeToHumanoidSpeed = rootVelMagnitude/16
	local stepCycle = math.sin(tick()*10) * 10
	
	if rootVelMagnitude > 0.1 then
		moveDirection = moveDirection:Lerp(rootVel.Unit, dt10)
	end
	print(stepCycle)
	rlOffset = Vector3.new(0,-stepCycle,stepCycle)
	print(rlOffset)
end

game:GetService("RunService").Heartbeat:Connect(function(dt)
	local rlCast = workspace:Raycast(rlStart.WorldPosition, Vector3.new(0,-3,0)-rlOffset, castParams)
	local llCast = workspace:Raycast(llStart.WorldPosition, Vector3.new(0,-3,0)-llOffset, castParams)
	
	if rlCast then
		rlGround.WorldPosition = rlCast.Position
	end
	
	if llCast then
		llGround.WorldPosition = llCast.Position
	end
	
	--moveLegs(dt) doesnt work
end)

Any help is appreciated.

I don’ t understand this at all, or what you are tryng to do. Are you tryng to make Strafing or Footplanting???

Solved by this post:

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