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

Camera.Interpolate on a scriptable camera does not move the camera, I cannot explain why, help?

Hi guys. Bit of a weird one, I'll start with the script & the output.

Code:

spook = coroutine.create(function()
	local camera = game:GetService("Workspace"):WaitForChild("Camera")
	print(camera.CameraType)
	print(camera.CFrame)
	print(camera.Focus)
	print(camera.CameraSubject)
	camera:Interpolate(CFrame.new(-1040.485, 1094.888, -4399.921),	CFrame.new(-1006.54065, 1095, -4399.55762), 2.26)
	wait(3)
	print(camera.CameraType)
	print(camera.CFrame)
	print(camera.Focus)
	print(camera.CameraSubject)
end)

coroutine.resume(spook)

Output:

  Enum.CameraType.Scriptable
  -1050.48499, 1094.48804, -4399.9209, -0.00826656818, -0.0227597207, -0.999706745, -1.45519152e-11, 0.999740899, -0.0227604974, 0.999965847, -0.000188151185, -0.00826442614
  -1030.49084, 1094.94324, -4399.75537, 1, 0, 0, 0, 1, 0, 0, 0, 1
  Humanoid
  Enum.CameraType.Scriptable
  -1050.48499, 1094.48804, -4399.9209, -0.00827694125, -0.011651231, -0.999897897, -4.53146569e-08, 0.99993211, -0.0116516305, 0.999965727, -9.63945567e-05, -0.0082763806
  -1030.48706, 1094.72107, -4399.75537, 1, 0, 0, 0, 1, 0, 0, 0, 1
  Humanoid

So the deal is the camera is in position -1050.48499, 1094.48804, -4399.9209 and is interpolating towards -1040.485, 1094.888, -4399.921, 10 studs forward. Or at least, it should be. But it doesn't. As you can see, the camera is scriptable, why does the camera not move not even one bit? I have a large script that randomly broke (I know code doesn't randomly break but still) and I have pinpointed the error to this section, and I now cannot explain why it's behaving like it is. Why does the camera not move? Thanks.

1 answer

The first parameter of Camera:Interpolate() is the end CFrame, not the starting CFrame. The function already knows the cameras starting position. The second paramater is the CFrame of the end result of camera.Focus.

2 comments

0

That's right, the camera is at the position of -1050 and is moving to -1040. The whole time it's moving from -1050 to -1040 I want the camera to be focused on -1006. However, the camera does not move from -1050 to -1040 despite me telling it to. That's the problem I'm having

0

Ah I get it now. Did you end up figuring it out?

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