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

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

Asked by
ItsMeKlc 235 Moderation Voter
7 years ago

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

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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
Don't forget to add an: if points[i+1] ~= nil then RubenKan 3615 — 7y
Ad

Answer this question