Alright, I am JUST delving into the art of camera positioning.
I have looked at the regular Roblox forums and the wiki but I can't really find suitable help.
Here's my line of code:
local cam = workspace.CurrentCamera cam.CameraSubject = game.Workspace.CameraPoint -- CameraPoint is a part cam.CameraType = "Attach" cam.CoordinateFrame=CFrame.new(-331.06, 9.56, 90.161) cam.Focus=CFrame.new(-331.86, 8.96, 90.961)
The user is spawned elsewhere, but the camera is here instead.
Just to help specify better what the CFrame and Focus thing are doing: http://prntscr.com/85hz9y
SO FAR it's only changed the camera view to attach and MAYBE at first set the focus towards the intended spot.
THE CODE IS put in a local script in the Starter Pack
OkOkOkOk, here's how you fix it.
Shocking, right? I know. Very. Terrifying, actually. How do we fix this!?!? I'm confused! Nononononono. We will use a useful thing called Interpolation. Interpolation for cameras Is. The. Cheese. Basically, what it is is a function that interpolates the camera from its position to another. in a given amount of time. Wait a second.. these are familiar. Oh yes, they are the parameters.
Now that we have these, let's Interpolate this camera.
game.Workspace.CurrentCamera:Interpolate(EndPos, EndFocus, Duration)
BUT, these will have to run at certain conditions.
So, with this information, we can interpolate the camera to the directions you have supplied.
local cam = workspace.CurrentCamera cam.CameraSubject = game.Workspace.CameraPoint -- CameraPoint is a part cam.CameraType = Enum.CameraType.Scriptable -- always use Enums local CoordinateFrame=CFrame.new(-331.06, 9.56, 90.161) local Focus=CFrame.new(-331.86, 8.96, 90.961) cam:Interpolate(CoordinateFrame, Focus, .1)
And voila, here you go, good sur!
HungryJaffer, Written with StackEdit.
You should set the camera mode before you change the rest of the camera's settings.
local cam = workspace.CurrentCamera cam.CameraType = "Attach" cam.CameraSubject = game.Workspace.CameraPoint