I have a main menu where the camera rotates based on the mouse movement, but when I implement a tween to move the camera somewhere else, the mouse rotation stops working when the camera moves, presumably as I can only tween the entire CFrame and not just the position. However, I can’t find out how to just tween the position of the camera without editing the entire CFrame.
Mouse rotate code:
rs.Heartbeat:Connect(function()
local dis = (center - Vector2.new(mouse.X, mouse.Y)) / 150
cam.CFrame = (CFrame.new(cam.CFrame.Position) * focus.CFrame.Rotation) * vectortorot(Vector3.new(dis.Y, dis.X, 0))
end)
(the vectortorot
function just turns the Vector3
into CFrame.Angles
)
Camera tween:
ts:Create(cam, ti, {CFrame = targetCFrame}):Play()
I can only use CFrame
for this, trying to use Position
only returns an error. I just need to tween the position without affecting the rotation.
Any help is appreciated.