Trouble Tweening Camera To Move Straight from PointA to PointB

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to tween the player camera when they click a button so that their camera will tween in a linear path.

  1. What is the issue? Include screenshots / videos if possible!

Instead of the camera going straight to the next camera, it does a twirl and goes upside down almost.

I made an image that hopefully depicts what I’m asking for. PointA is the camera where the tween starts and then the black line indicates a straight line from PointA to PointB. That’s what I want to accomplish.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried looking on Youtube & Dev Forum to help my question, couldn’t find anything exactly that could help me. So I decided to post my question as a topic. Hopefully someone can help me, any help is appreciated.

Here’s my Code So Far:

-- This is an example Lua code block
local TS = game:GetService("TweenService")

local camera = workspace.CurrentCamera

local cam2 = workspace.Map.Properties.Property2.Property2Cam -- the camera2 (end goal)

script.Parent.MouseButton1Click:Connect(function()
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = cam2
	local TI = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0)
	local Goal = {CFrame = cam2.CFrame} --declaring my end goal for the tween
	local Anim = TS:Create(camera,TI,Goal)
	Anim:Play()
end)

Please give me suggestions on how I can modify my code, or if there’s something I’m missing. If you need more info on what I’m asking help for please ask me.

local TS = game:GetService("TweenService")

local camera = workspace.CurrentCamera

local cam2 = workspace.Map.Properties.Property2.Property2Cam -- the camera2 (end goal)

script.Parent.MouseButton1Click:Connect(function()
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = cam2
	local TI = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0)
	local Goal = {CFrame = CFrame.new(cam2.CFrame.Position)}
	local Anim = TS:Create(camera,TI,Goal)
	Anim:Play()
end)

what do you mean by your post?

Try this:
local Goal = {CFrame = CFrame.new(cam2.CFrame.Position, camera.Position) * CFrame.Angles(0, math.rad(180), 0)}

1 Like

I’ll try this and I’ll get back to you if it works

Thank you so much it worked !!