Use A Unit Vector Direction To Set Part Orientation On Y Axis

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

i have a vector like the Humanoid.MoveDirection and i want rotate a part in the y axis
Examples of the vector:
0.6, 0, -0.7
1, 0, 0
-0.2, 0, 0.9

1 Like

why not use Part.Orientation.Y? and Vector3.Y to get y axis of a vector 3

1 Like

Is a direction vector between 2 points in a plane, y always is 0

print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(-1,0,0).Unit).X))) --0
print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(1,0,0).Unit).X))) --180
print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(1,0,-1).Unit).X))) --134
print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(1,0,1).Unit).X))) --134
print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(-1,0,-1).Unit).X))) --45
print(math.deg(math.acos((Vector3.new(0,0,0) - Vector3.new(-1,0,1).Unit).X))) --45
--This help?

if i do it with .Z and get 2 degres i can make a rotation Y?

i dont understand what u mean, but vector3 is for 3d world space also it goes (X, Y, Z)

how i can rotate a part in only one axis with a humanoid walk direction?

You can rotate a Vector3 by multiplying it by a rotational CFrame (just a cframe but with rotations). It will rotate the Vector3 to the CFrame's orientation:

print(Vector3.new(5, 1, 5) * CFrame.new(Position.X, Position.Y, Position.Z, rotationDataHere))