Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get other lookVectors? [ANSWERED]

Asked by
ItsMeKlc 235 Moderation Voter
8 years ago

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?

0
You can use vectorToWorldSpace to do this. EgoMoose 802 — 8y

2 answers

Log in to vote
1
Answered by
EgoMoose 802 Moderation Voter
8 years ago

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
Ad
Log in to vote
0
Answered by
ItsMeKlc 235 Moderation Voter
8 years ago

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

0
Why thank you kind sir, you're awesome! ItsMeKlc 235 — 8y

Answer this question