Part point where camera is pointing

I remember I saw the solution in a post and it was very large and messy. Does anyone know a simpler way? I need a part to point where the camera is facing, not just the cameras orientation.

1 Like

I’m not exactly sure what you’re asking for, but something like this should set a part’s position and orientation to the current camera:

-- This would only work on the client or in studio.
local Part = [Path to part]
local Camera = workspace.CurrentCamera
Part.CFrame = Camera.CFrame
1 Like

Uh, well I meant I want a part that faces where the camera is facing. So, if a part is to my left, then it won’t face the same orientation as the camera, it will face where the camera is pointing.

1 Like

So are you looking to make a part face towards the camera or make it face the position that the camera is looking at?

1 Like


Imagine that the red ball is where the camera is facing/looking at. I want the part to point at the red ball, aka where the camera is looking at.

1 Like

So you’re saying that you want the part to face in the direction of whatever point that whatever the camera is looking at. In that case:

local Part = script.Parent
local Camera = workspace:WaitForChild("Camera")
local LookVector = Camera.CFrame.LookVector
local Raycast = workspace:Raycast(Part.Position, LookVector * 1000)

if Raycast then
    Part.CFrame = CFrame.new(Part.Position, Raycast.Position)
end
3 Likes

I’ve done the camera orientation and copy the camera orientation and change the part orientation, so if you connect the camera to the part’s position, it will automatically change the orientation or rotation or whatever.