I will set a function which depends on how fast the camera is rotating each second. But, I've been stuck on this part.
Any help would be Highly Appreciated! Thanks in advance.
Here is a code that prints camera rotation speed and movement speed, difference is that movement speed is not 0 when you are zooming in and out:
local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local currentCamera = Workspace.CurrentCamera local previousCFrame = currentCamera.CFrame RunService.RenderStepped:Connect(function() local cframe = currentCamera.CFrame local speed = (previousCFrame.Position - cframe.Position).Magnitude local _, rotation = (cframe * previousCFrame:Inverse()):ToAxisAngle() print(("Current movement speed of camera: %d"):format(speed)) print(("Current rotation speed of camera: %d"):format(math.deg(rotation))) previousCFrame = cframe end)
To get the movement speed you calculate distance between current camera position and camera position from previous frame, for angle I just stole the code here, since the result was in radians using math.deg
I converted it to degrees, it's too hard of a math :o