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

How do I use the Interpolate method? [closed]

Asked by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

I've been experimenting with Interpolate, the method that allows scripters to move the camera smoothly from one position to another. Unfortunately, whenever I try to use this to move the camera smoothly through a model full of bricks, my screen turns white and I can see nothing.

The model of bricks in which I want the camera to move through has hierarchy like this:

Model
    1
    2
    3
    4   
    (etc.)

with the numbers being parts. Here is the code that I'm using, slightly modified for clarity's sake. Please assume all undefined variables are properly defined and equal to the instance they are named for. (Because they are correct, I've checked...)

for i = 1, #model:GetChildren() do
    camera:Interpolate(model[tostring(i)].CFrame, model[tostring(i)].CFrame, 3)
    wait(3)
end

What this should do is smoothly tween the camera to the next brick in the model (which is defined) every three seconds. Since each brick's name is a number, model[tostring(i)] is correct. Each time the camera moves, it should be looking at the next part in the sequence because of the second argument I gave Interpolate(). Unfortunately, everything simply turns white.

-This is a Local Script

-Variables are defined properly

-The code does not run immediately when the game starts, so I'm fully loaded.

-No errors are shown in the output and no warnings are in Script Analysis.

0
Why was this downvoted? It's a perfectly good question and follows all the guidelines given in the "How to post good questions and answers" page. Perci1 4988 — 9y
1
@Perci1, I know right. Some of these excessive and unreasonable downvotes should be monitored. M39a9am3R 3210 — 9y

Locked by Perci1 and TurboFusion

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 9 years ago

The reason the screen turns white is because you're setting the Focus and the CoordinateFrame of the Camera as the same CFrame. If you do so, you'll get a white screen. In order to fix it, set the focus to at least 1 stud away from the brick that CoordinateFrame is set to. Like so:

for _,Obj in pairs(model:GetChildren()) do
    camera:Interpolate(Obj.CFrame, Obj.CFrame + Obj.CFrame.lookVector, 3)
    wait(3)
end

Hope this helped!

0
Thanks a ton. Perci1 4988 — 9y
Ad