How to know which direction Humanoid MoveDirection is going?

So I am trying to detect when a player is either moving backwards, forwards, left, right, diagonally forward to the right, diagonally forward to the left, diagonally backwards to the left, and diagonally backwards to the right

The problem is that I dont know which combinations of numbers for MoveDirection can be equivalent to the direction I stated above

edit: I forgot the word but basically what Im looking to create is locomotion

Step-directions-and-locomotion-in-space-on-the-topic-of-angles-in-EWMN

5 Likes

You might find this post useful…

Lmk if you need any more help :slight_smile:

2 Likes
1 Like

Alright I get how he made the solution but Im confused about where he is getting the velocity?

I am pretty sure that is also included in the topic, under post 4 or 6.

Oh alright gotcha he was using the velocity of the humanoid, I just need to replace that with my humanoid movedirection relative to my root’s cframe in object space

I’ll test it and get back to you

What I have so far
image

omg DUDE THANK YOU SO MUCH IT WORKED, also thank you to that guy from that post

image

Anyone else wondering how to do it with movedirection here is my code

local movedir = root.CFrame:VectorToObjectSpace(humanoid.MoveDirection)
local yDirection = math.atan2(movedir.X,movedir.Z)
local roundedDirection = math.ceil(math.deg(yDirection) - 0.5)
print(roundedDirection)
9 Likes