Applying Stilts Logic

Hi,
I have been trying to create walking stilts for my game, but when i tried to replicate this movement logic, just holding W to move forward (not towards the mouse):

I only could do the moving forward, with no legs spreading forward, here is what i have done so far:


But i noticed that changing the legs rotation, can replicate the movement I’m looking for, however i don’t know how to do it using math:

Attaching Script:

function Attacher:Attach(leftFoot,rightFoot,leftStilt,rightStilt)
	local leftFootAttachment = leftFoot.LeftFootAttachment
	local rightFootAttachment = rightFoot.RightFootAttachment
	local leftStiltAttachment = leftStilt.Attachment
	local rightStiltAttachment = rightStilt.Attachment

	local leftAlignPosition = Instance.new("RigidConstraint")
	leftAlignPosition.Attachment0 = leftStiltAttachment
	leftAlignPosition.Attachment1 = leftFootAttachment
	leftAlignPosition.Parent = leftStilt

	local rightAlignPosition = Instance.new("RigidConstraint")
	rightAlignPosition.Attachment0 = rightStiltAttachment
	rightAlignPosition.Attachment1 = rightFootAttachment
	rightAlignPosition.Parent = rightStilt
end

Balance (Movement):

function Balance:Balance(leftStilt,rightStilt,character,humanoid)
	local bodyGyro = Instance.new("BodyGyro")
	bodyGyro.MaxTorque = Vector3.new(1000, 1000, 1000)
	bodyGyro.P = 3000
	bodyGyro.Parent = character.HumanoidRootPart
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	
	connection = RunService.Heartbeat:Connect(function()
		if humanoid.MoveDirection.Magnitude > 0 then
			local moveDirection = humanoid.MoveDirection * 20
			leftStilt.AssemblyLinearVelocity = moveDirection
			rightStilt.AssemblyLinearVelocity = moveDirection
		else
			leftStilt.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
			rightStilt.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
		end
	end)
	return connection
end

I don’t know about you, but i do have some belief that you have to use velocities and such

Yes, I’m using BodyGyro to move the player, but the main issue here is applying the spreading legs forward logic, which I cannot seem to do.

are you somehow using studio on a tablet or a computer from the 1970’s or something what is that ratio no wonder you have to setup studio like that

1 Like

Is this even related to my issue? do not reply if u aint gonna help