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

Why won't focus update in tweening camera function?

I'm trying out a tweening camera sort of function. Basically, when you "scroll" the mouse wheel forwards the camera zooms in and vice versa. The problem is the camera is zooming in past the object, and the orientation of the camera is not remaining focused on the object. I tried adding "Focus = base.Cframe" and "Focus = currentModel.PrimaryPart.CFrame" base being the block under the model being displayed and currentModel being the model displayed at that time. The focus does not change in the tweening animation however in either of these cases.

local function zoomDisplay(direction)
		local tweenInfo = TweenInfo.new(
			2,								
			Enum.EasingStyle.Linear,		
			direction,		
			0,								
			true,							
			0								
		)
 
		
		local propertyGoals =
		{
			Focus = currentModel.PrimaryPart.CFrame, --This is making no change to the animation even though I'm pretty sure it should be...
			CoordinateFrame = CFrame.new(base.Position) * CFrame.new(0, 10, 5)
		}
 
		
		local tween = TweenService:Create(cam,tweenInfo,propertyGoals)
		tween:Play()
	end
	
	mouse.WheelForward:connect(function()
		zoomDisplay(Enum.EasingDirection.In)
	end)
	
	mouse.WheelBackward:connect(function()
		zoomDisplay(Enum.EasingDirection.Out)
	end)
	

1 answer

You cant use tween service for tweening a camera

cam:Interpolate( CFrame endPos,CFrame endFocus,float duration)

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