Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get other lookVectors? [ANSWERED]

For a script I'm creating I need to get the direction the top of a part is facing. How do you get other lookVectors besides the front?

1 comment

0

You can use vectorToWorldSpace to do this.

2 answers

✓ Accepted answer

You can also easily use the vectorToWorldSpace to get the surface normals from a CFrame:

local cframe = CFrame.new();
local up = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Top));
print(up);
-- 0, 1, 0

Why hello, the awesome ItsMeKlc.

I have figured out the answer to your problem

left = (part.CFrame * CFrame.Angles(0, -math.pi/2, 0)).lookVector right = (part.CFrame * CFrame.Angles(0, math.pi/2, 0)).lookVector up = (part.CFrame * CFrame.Angles(-math.pi/2, 0, 0)).lookVector down = (part.CFrame * CFrame.Angles(math.pi/2, 0, 0)).lookVector

1 comment

0

Why thank you kind sir, you're awesome!

This discussion is preserved as it was. New answers, comments, and votes are closed.