The values for the position and orientation work perfectly there
The issue is that while the camera sets the position, it does not set the orientation no matter what I change the numbers to.
The script is there below (I don’t use the lookAt and pos variable here so ignore it)
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local lookAt = Vector3.new(2, -120, 0)
local pos = Vector3.new(-861.1037, 10.853, -952.341)
local carSceneEvent = game.ReplicatedStorage:FindFirstChild("carScene")
function changeCamera()
camera.CameraType = Enum.CameraType.Scriptable
--camera.CameraSubject = game.Workspace["Car "]
camera.CFrame = CFrame.new(Vector3.new(-861.163, 10.905, -952.109), Vector3.new(-5.977, -115.706, 0))
end
carSceneEvent.OnClientEvent:Connect(changeCamera)
Yet, even though the vector3 values are the exact same it just isn’t the same. And then when I check the values in the explorer they aren’t the ones I set for the orientation.
First time posting in the forum, so let me know if I missed any critical information.
One possible reason for this issue is that the second Vector3 argument in CFrame.new() represents the “look” direction, not the “up” direction. By providing Vector3.new(-5.977, -115.706, 0) as the second argument, you might not be achieving the desired orientation.
To set the camera’s orientation towards the specific area (the car), you can use the lookAt vector you defined. Here’s a modified version of your code:
function changeCamera()
camera.CameraType = Enum.CameraType.Scriptable
--camera.CameraSubject = game.Workspace["Car "]
camera.CFrame = CFrame.new(pos, pos + lookAt)
end
By using CFrame.new(pos, pos + lookAt), the camera will be oriented towards the area defined by the lookAt vector.
when dealing with cameras I usually just create an invisible part and face it in the right direction and place. Maybe not the best way but surely the easiest