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

Having issues with camera interpolation. How do I get it to face the correct direction?

Hey, messing around with camera interpolation. I'm trying to get the camera to follow the path of parts I've made, it works for the most part, but the direction the camera is facing is messed up... Why?

wait(1)
local scene = game.ReplicatedStorage.other.cutscene:Clone()
scene.Parent = game.Workspace
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local points = scene.tween_points:GetChildren()
game.Workspace.CurrentCamera.CFrame = scene.tween_points["1"].CFrame
for i=1,#points do
	game.Workspace.CurrentCamera:Interpolate(points[i].CFrame,CFrame.new(points[i].CFrame.lookVector),points[i].speed.Value)
	wait(points[i].speed.Value) 
end

1 answer

The second argument of the Interpolate function should be a CFrame for the focus of your camera perspective.

If you make it the next consecutive point, then your camera will look at that point.

local cam = workspace.CurrentCamera;
local scene = game.ReplicatedStorage.other.cutscene:Clone()
scene.Parent = workspace
cam.CameraType = "Scriptable"
local points = scene.tween_points:GetChildren()

cam.CFrame = points["1"].CFrame;
for i=1,#points do
   	cam:Interpolate(points[i].CFrame,points[i+1].CFrame,points[i].speed.Value)
    wait(points[i].speed.Value) 
	cam.InterpolationFinished:wait();
end

1 comment

1

Don't forget to add an: if points[i+1] ~= nil then

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