So, i’ve been trying to make so the player character tilts in the right/left direction, if they are only walking towards that direction. However, the issue is that, since its a Vector3, it wont align up with the player’s orientation, heres a short video
The way i made it tilt was relatively simple, took about 6 lines of code.
Also, root is the HumanoidRootPart.
local Xspeed = root.Velocity.X
if root.Velocity.X > root.Velocity.Z then
Xspeed = root.Velocity.X
else
Xspeed = 0
end
The velocity property is a vector, and velocity vectors denote both direction and speed. The magnitude of the vector is the speed, with the components making up the direction. You can think of a velocity that is (0, 5, 0) as a movement towards the sky at 5 studs per second.
Rather than using the velocity to determine the move vector, you should use the movedirection property of the humanoid.
use humanoid.MoveDirection:Dot(humanoidRootPart.CFrame.RightVector)
it should give you a number -1 to 1 corresponding to left/right
i can explain the math further if u want