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

How do i use lookVector to point the players camera to a part?

Asked by
Teeter11 281 Moderation Voter
9 years ago

So lets say i have the players camera stuck in one spot using Camera.CoordinateFrame but what if i wanted to point the camera to something? How could i do this?

Also would the camera look to the left with it?

Thanks!

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

You actually need to use the CFrame constructor that takes two Vector3 values:

--LocalScript

local cam = workspace.CurrentCamera
local camPos = Vector3.new(5, 5, 5) --Example
local target = workspace.Part

cam.CoordinateFrame = CFrame.new(camPos, target.Position)

lookVector is a read-only Value.

0
And that constructor is 'CFrame.new(Vector3 position, Vector3 point)'. It creates a CFrame at position, looking at point. Perci1 4988 — 9y
Ad

Answer this question