I’ve mentioned it in the post
Char count
I’ve mentioned it in the post
Char count
Camera still flies away but in a strange way.
Here’s the code in case you are wondering.
Camera.CFrame = Camera.CFrame:Lerp(Goal, 1 - time() ^ DeltaTime)
I mean the t being the amount of seconds to lerp, kind of like the first parameter in TweenInfo.new()
Also we should also make sure that my code works properly since i cant test it, so disable this script, and then create a new LocalScript inside of starterCharacterScripts and paste the example code i provided:
local RunService = game:GetService("RunService")
local cam = workspace.CurrentCamera
local head = script.Parent:WaitForChild('Head')
RunService.RenderStepped:Connect(function()
-- zAxis is basically the equivalent of saying "Vector3.new(0,0,1)"
local camZ = Vector3.zAxis * cam.CFrame.Position
local headZ = Vector3.zAxis * head.Position
local magnitude = (camZ - headZ).Magnitude
print('current zoom level: '..magnitude)
end)
It has a bit of problem.
When I stand still and don’t do anything (I don’t even touch keyboard and mouse) the values it prints are different. They go between 12 and 13 (in my current zoom level case). That’s probably why camera flies away probably.
I edited it, i just flipped the values so instead of headZ - camZ
I changed it to camZ - headZ
, not sure if it’ll fix it but worth a try
Yep, it works now. Camera doesn’t fly away. However, the zoom in/out doesn’t work which is probably because it gets the distance between camera position and head position.
I think I will just give up on it until I will find a solution.
Your code doesnt look like to have a zooming functionaility, could you quote it so i can try to help?
Well i guess you could mark this as a solution since its the main solution for the topic.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.