Hi there, I was trying to make a custom movement system but I don’t know how to make the movement/move direction a unit vector. Vector3.Unit works but I don’t know how to implement it in my case:
local Keys = {
Horizontal = Input.GetKey("D","Left") - Input.GetKey("A", "Right"),
Vertical = Input.GetKey("W","Up") - Input.GetKey("S","Down")
}
local Force = (CameraLookVector * Keys.Vertical + CameraRightVector * Keys.Horizontal) * Speed
This is the code (shortened) but when moving diagonally, the player moves way faster than in any single direction which I do not want.
Thanks. (This question is probably answered in a different post(s) but I can’t find them.)
I don’t understand.
The reason I use Keys.Horizontal and vertical is to get the direction of the player. The GetKey function returns a value of 0,1.
If I pressed W or Up then it would say one in Vertical, and S would say -1. (Pressing both gives 0 and neither is still 0)