What is a LookVector

  local camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector

I understand except for .LookVector. I know the LookVector is indicating a forward direction(0, 0, -1)
but
CFrame of cam(CurrentCamera) measured hrp(HumanoidRootPart) to center of world + LookVector
It doesn’t make any sense to me. Can you explain this code?
Also What is Lookvector for? cam or hrp

Well… it’s lookvector, where the CFrame is facing. You can use this to calculate directions (for velocity and stuff). I’ve prepared a video that shows this:

(the side with the random decal is the front, you don’t need to watch the whole video)

the command that I ran in the video is:

workspace.Part.Velocity = workspace.Part.CFrame.lookVector * 10
1 Like

You made video for me Thanks a lot :grinning:
I understand what your video is about.
But still confused about

hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector

1 Like

No problem bud! :smiley:

Anyways, I believe this would give the direction from the camera to the humanoidRootPart (or the other way around). Here’s a link about worldspace if you need it

Hope this helped just a little :heart:

3 Likes

For future reference, you can use the Developer Hub before asking a question.

CFrame (roblox.com)