Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] | Camera Manipulation Troubles. Help?

I've been trying to make a "menu", so I was going to place the camera in a spot, have it look at a point, and start from there. When I got to the point of setting where the camera looks, I ran into a problem. Using Camera.Focus and Camera.CameraSubject won't work for me. (I tried them both separately)

This is in a local script in StarterPlayerScripts. I've tried looking at the wiki and youtube but I can't figure it out. Here is my code:

local player = script.Parent.Parent
local character = player.Character
local humanoid = character.Humanoid

local cam = game.Workspace.CurrentCamera

function setUpCam()
	local camNewLocation = game.Workspace.CameraLocationOne.CFrame
	cam.CameraType = "Scriptable"
	cam.CFrame = camNewLocation
	cam.Focus = game.Workspace.CameraFocusOne.CFrame
end

wait(3)

setUpCam()

It's probably something very simple that I'm missing, as I'm new to scripting...

Thanks! -Kyleo

1 comment

0

What worked for me is remove the cam.Focus line and put this into the starterpack

1 answer

✓ Accepted answer

The Scriptable camera does not allow for Focus to be set independent of the Coordinate Frame.

Use the following format for setting Focus on a Scriptable camera:

Given two Vector3 values:

camera.CoordinateFrame = CFrame.new(PositionCameraIS, PositionCameraPoints)

Given two CFrame values:

camera.CoordinateFrame = (CFramePositionIS, CFrameCameraPoints)

So in your case:

cam.CameraType = Enum.CameraType.Scriptable
cam.CoordinateFrame = (camNewLocation, game.Workspace.CameraFocusOne.CFrame)

2 comments

0

It still doesn't work? I tried that and it didn't accept the comma it just wanted close parenthesis?

0

Got it to work by adding CFrame.new to the front and swaping to Vector3! :P

This discussion is preserved as it was. New answers, comments, and votes are closed.