#best way to go about a directional movement system

1 messages · Page 1 of 1 (latest)

inland seal
#

i was wondering what the best way to make a directional movement system would be
im not sure if itd be better to have a few animations like backwards and forwards and lerp for a/d
or if it would be better to have a full 8 anims or if itd be better to just lerp without any extra animations
my main issue is that by swapping the animations you can kinda make them look buggy is you spam different keys, but if you lerp you lose customization and it looks worse

crisp kiln
#

don't put any animation

#

use IKcontrol and manually code the movement

#

so it works for every direction

polar wraith
#

use :dot

inland seal
frank bayBOT
#

studio** You are now Level 2! **studio

inland seal
#

thanks

#

btw normalface i feel like rewriting an entire movement system would suck

#

i dont need it

#

im too lazy and im not at that level

#

@polar wraith

#

local torsoRotation = 20

local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local humanoidRootPart = character.HumanoidRootPart
local Torso = character.Torso

local rootJoint = humanoidRootPart.RootJoint
local lLeftHipJoint = Torso["Left Hip"]
local rightHipJoint = Torso["Right Hip"]

local function Lerp(a, b, c)
return a + (b - a) * c
end

local force = nil
local direction = nil
local value1 = 0
local value2 = 0

local rootJointC0 = rootJoint.C0

RunService.RenderStepped:Connect(function()

force = humanoidRootPart.Velocity * Vector3.new(1,0,1)
if force.Magnitude > 0.001 and UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then

    direction = force.Unit
    value1 = humanoidRootPart.CFrame.RightVector:Dot(direction)
    value2 = humanoidRootPart.CFrame.LookVector:Dot(direction)
else
    value1 = 0
    value2 = 0
end



rootJoint.C0 = rootJoint.C0:Lerp(rootJointC0 * CFrame.Angles(math.rad(value2 * torsoRotation), math.rad(-value1 * torsoRotation), 0), 0.2)

end)

#

this is my current script

#

i reused it from an old game

#

it has a few issues

#

for example after you stop moving theres a weird like .1 shift to the idle anim that looks bad

#

also it doesnt work with backwards anims

#

im making a soccer game and the balls rolling direction needs to change when going backwards

crisp kiln
inland seal
#

js to be specific im trying to make it where when shiftlock is enabled the walk looks different in each direction

#

like in games like goalbound or project egoist and so on

polar wraith
inland seal
#

ive decided to use 8 different anims

#

but i wanna incorporate it into the default animate script