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