You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Hello fellow Developers, i have been looking to find a way to replicate this movement system on dark soul 3 , which is when the player moves Right or Left , he doesnt just move to that specefic direction but rather he rotate on himself to end up comming back to the starting point where he first intiate moving (Right or Left), you will see what i mean in the video , btw just to mention i was only Moving Right & Left Using this Only two Keys D,A -
What is the issue? Include screenshots / videos if possible!
Watch dark soul 3 Movement Left,Right | Streamable
here is The current Movement System that i have implemented in the game for anyone who is curious i will truly appreciate any help in this matter, thank you
local RunS = game:GetService("RunService")
local InputS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
local targetMoveVelocity = Vector3.new()
local moveVelocity = Vector3.new()
local moveAcceleration = 18
player.CharacterAdded:Connect(function(_character)
character = _character
end)
local walkKeyBinds = {
Forward = { Key = Enum.KeyCode.W, Direction = Enum.NormalId.Front },
Backward = { Key = Enum.KeyCode.S, Direction = Enum.NormalId.Back },
Left = { Key = Enum.KeyCode.A, Direction = Enum.NormalId.Left },
Right = { Key = Enum.KeyCode.D, Direction = Enum.NormalId.Right }
}
local function getWalkDirectionCameraSpace()
local walkDir = Vector3.new()
for keyBindName, keyBind in pairs(walkKeyBinds) do
if InputS:IsKeyDown(keyBind.Key) then
walkDir += Vector3.FromNormalId( keyBind.Direction )
end
end
if walkDir.Magnitude > 0 then
walkDir = walkDir.Unit
end
return walkDir
end
local function lerp(a, b, c)
return a + (b - a) * c
end
local function getWalkDirectionWorldSpace()
local walkDir = camera.CFrame:VectorToWorldSpace( getWalkDirectionCameraSpace() )
walkDir *= Vector3.new(1, 0, 1)
if walkDir.Magnitude > 0 then
walkDir = walkDir.Unit
end
return walkDir
end
local function updateMovement( dt )
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
local moveDir = getWalkDirectionWorldSpace()
--print(getWalkDirectionCameraSpace())
targetMoveVelocity = moveDir
moveVelocity = lerp( moveVelocity, targetMoveVelocity, math.clamp(dt * moveAcceleration, 0, 1) )
humanoid:Move( moveVelocity )
end
end
RunS.RenderStepped:Connect(updateMovement)