#How do i fix my directional rotation movement system it keeps messing with the walk animation

1 messages · Page 1 of 1 (latest)

mental junco
#

sorry for lag

modest marsh
#

looks fine ..?

craggy pivot
#

i mean whats wrong?

mental junco
#

no

#

like

#

its like interupting the animation

modest marsh
mental junco
#

yeah

#

sure

modest marsh
#

i dont see anything wrong in the video you showed, maybe its subtle but a clearer recording will help

mental junco
#

wanna go in voice so i can stream?

modest marsh
mental junco
#

so how are u gonna know nvm

#

heres the code

#

local rs = game:GetService("RunService")

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local trs = char:WaitForChild("Torso")
local leftleg = char:WaitForChild("Left Leg")
local rightleg = char:WaitForChild("Right Leg")

local rootJoint = hrp:WaitForChild("RootJoint")
local neckJoint = trs:WaitForChild("Neck")
local leftHip = trs:WaitForChild("Left Hip")
local rightHip = trs:WaitForChild("Right Hip")
local oriRootJointCF = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local oriNeckJointCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local oriLeftHipCF = leftHip.C0
local oriRightHipCF = rightHip.C0

local tilt = CFrame.new()
local maxTilt = 20
local legtilt = 10

rs.RenderStepped:Connect(function(delta)
local moveDirection = hrp.CFrame:VectorToObjectSpace(char.Humanoid.MoveDirection)
local xTilt = -math.rad(moveDirection.X) * maxTilt
tilt = tilt:Lerp(CFrame.Angles(0, 0, xTilt), 10 * delta)
rootJoint.C0 = oriRootJointCF * tilt
neckJoint.C0 = oriNeckJointCF * tilt:Inverse()
leftHip.C0 = oriLeftHipCF * (tilt * CFrame.Angles(0, 0, xTilt * 0.3))
rightHip.C0 = oriRightHipCF * (tilt * CFrame.Angles(0, 0, xTilt * 0.3))
end)

modest marsh
#

why are you messing with the joints

mental junco
#

isnt that what ur supposed use to rotate limbs

#

?

modest marsh
#

local xTilt = -math.rad(moveDirection.X) * maxTilt that's the only tilt you're dealing with, that's probably why there's a problem with one axis, because there is only the x axis. where is the code to deal with zTilt?

#

XZ is horizontal movement, but you only have X in there 👍

mental junco
#

k

modest marsh
#

i'm not sure about how your math is playing out exactly, but the fact that Z isn't factored in at all is a clear part of the problem

mental junco
#

thx

modest marsh
#

normally animations just simply deal with this as part of animating but if you want to animate manually like that... well that's where i'd start fingerguns

mental junco
#

so like this right ```local rs = game:GetService("RunService")

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local trs = char:WaitForChild("Torso")
local leftleg = char:WaitForChild("Left Leg")
local rightleg = char:WaitForChild("Right Leg")

local rootJoint = hrp:WaitForChild("RootJoint")
local neckJoint = trs:WaitForChild("Neck")
local leftHip = trs:WaitForChild("Left Hip")
local rightHip = trs:WaitForChild("Right Hip")
local oriRootJointCF = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local oriNeckJointCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local oriLeftHipCF = leftHip.C0
local oriRightHipCF = rightHip.C0

local tilt = CFrame.new()
local maxTilt = 20
local legtilt = 10

rs.RenderStepped:Connect(function(delta)
local moveDirection = hrp.CFrame:VectorToObjectSpace(char.Humanoid.MoveDirection)
local xTilt = -math.rad(moveDirection.X) * maxTilt
local zTilt = -math.rad(moveDirection.Z) * maxTilt
tilt = tilt:Lerp(CFrame.Angles(zTilt, 0, xTilt), 10 * delta)
rootJoint.C0 = oriRootJointCF * tilt
neckJoint.C0 = oriNeckJointCF * tilt:Inverse()
leftHip.C0 = oriLeftHipCF * (tilt * CFrame.Angles(zTilt * 0.3, 0, xTilt * 0.3))
rightHip.C0 = oriRightHipCF * (tilt * CFrame.Angles(zTilt * 0.3, 0, xTilt * 0.3))
end)```

#

what the hell

#

i tried it

#

and its like

#

worse

#

why am i walking forward liek this

#

@modest marsh

#

help meeeeeeee

modest marsh
mental junco
#

i would have to show u on stream bruh

#

its like bad

modest marsh
#

chatgpt isnt good for stuff like this ;o

modest marsh
mental junco
#

no i found an dev post so it can help with what im doing

#

it worked

#

but only for the torso

#

and i wanted it to be more realistic

#

so i added in the legs to

#

then

#

._.

modest marsh
#

what are you trying to do

mental junco
#

like make the legs rotate based on ur move direction

#

like this

#

video

modest marsh
#

you mean in the video where you strafe left/right and the torso turns a bit in that direction?

#

with the shiftlock on?

mental junco
#

i wanted to but no

#

im close to that but

#

yeah

#

see

#

but irs not working

#

pls help me @modest marsh

modest marsh
modest marsh
mental junco
#

no like in all dierections it will rotate based on if ur moving in more of a right dierection or a left dierection

#

the toror and the legs

modest marsh
#

if you got the torso working just fine, shouldn't have to do anything for the legs

mental junco
#

yeah but

#

i want my game to be like that video

modest marsh
#

but it sounds like you starting to enter objectspace with this, because you only have X in the stride, that would work in objectspace, but not in worldspace, and since you want to animate manually, the math gets a bit tricky

modest marsh
mental junco
#

no

#

no no

#

not animate manualt

#

manually

#

thats for later i just wannt get the rotation down

modest marsh
mental junco
#

NO

modest marsh
#
    rootJoint.C0 = oriRootJointCF * tilt
    neckJoint.C0 = oriNeckJointCF * tilt:Inverse()
    leftHip.C0 = oriLeftHipCF * (tilt * CFrame.Angles(0, 0, xTilt * 0.3))
    rightHip.C0 = oriRightHipCF * (tilt * CFrame.Angles(0, 0, xTilt * 0.3))```
mental junco
#

it rotates the legs

#

and the torso

modest marsh
#

i'm very confused to what you're asking for

mental junco
#

omg

modest marsh
#

your video looked fine?

mental junco
#

its not

#

let me show u in stream bro

modest marsh
#

you dont pay me enough to do that

#

well, hopefully an animator comes along who knows better than i 🤷

#

or someone willing to do that for less

mental junco
#

this is code bruh

#

u dont get it bro

#

in simpler words

modest marsh
#

gl salute

mental junco
#

omg

#

wait

#

ill USE MOTOR 6DS

#

IT WORKS