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

[SOLVED] | Camera Manipulation Troubles. Help?

Asked by 8 years ago

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

0
What worked for me is remove the cam.Focus line and put this into the starterpack xuefei123 214 — 8y

1 answer

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
8 years ago

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)
0
It still doesn't work? I tried that and it didn't accept the comma it just wanted close parenthesis? Kyleocraft 25 — 8y
0
Got it to work by adding CFrame.new to the front and swaping to Vector3! :P Kyleocraft 25 — 8y
Ad

Answer this question