Problem: trying to make the current player holding tool go slightly transparent when the player is fully zoomed in. Is there any readable value of the player zoom?
I think you would check the magnitude of the camera’s distance to the head. (local script)
local camera = workspace.CurrentCamera
local head = game.Players.LocalPlayer.Character.Head
local zoom = (camera.CFrame.Position-head.CFrame.Position).Magnitude
There is no difference in this case. Magnitude measures the distance between the two points. It can only be positive and will produce the same result. Please only correct others if you know that they are wrong based on experience.
1 Like
Oops, didn’t know that. I apologize for the confusion. I’ll delete the other comment because I do not want to confuse others.
1 Like
you should make it so it can only calculate the Z axis of each one, because it zooms on the Z axis, if you include other axis then it would change if you rotate the camera right and left, up and down:
local cameraZ = workspace.CurrentCamera.CFrame.Position * Vector3.zAxis
local headZ = game.Players.LocalPlayer.Character.Head.CFrame.Position * Vector3.zAxis
local zoom = (cameraZ-headZ).Magnitude
That also wouldn’t matter. It rotates, but it doesn’t change the distance. Check it out for yourself.