What is lookvector

  1. What do you want to achieve? I want to learn about lookvector. I have tried searching it up on youtube but no luck. Can you help?

I also want to learn what times I should use them. I have seen many tutorials and they bring them up but I never seem to understand what it means.

  1. What solutions have you tried so far? Youtube

local part = --location
part.CFrame = part.CFrame * CFrame.new(0, 0, -5)  -- moves it forward 5 studs
--on the Z-plane
-- Way using lookVector
-- If facing straight forward, lv is <0, 0, -1>
local cf = part.CFrame
local lv = cf.lookVector
part.CFrame = cf + (lv * Vector3.new(5, 5, 5))

it makes the part look in a different directions

2 Likes

So lets say I have a part that moves around and i want the other part to face it can I do:

‘’’ local part = --location
part.CFrame = part.CFrame * CFrame.new(0, 0, -5) – moves it forward 5 studs
–on the Z-plane
– Way using lookVector
– If facing straight forward, lv is <0, 0, -1>
local cf = part.CFrame
local lv = cf.lookVector
part.CFrame = cf + (lv * movepart.CFrame)’’’

Google before you post please What Is CFrame? | Roblox CFrame Tutorial | LookVector, Angles & More! - YouTube

1 Like

LookVector is exactly 1 stud away in the normal direction of any part’s front.

1 Like

Here is the source of the original reply, which also gives more context and different explanations.

1 Like