I don’t know how to calculate the CFrame while considering the FieldOfView at the moment aiming down sights is completed.
When I run this script, it gives consistent results, but as shown in the pictures below, the sight only appears exactly at the center of the screen when the player’s camera FieldOfView is 70.
If the FieldOfView is smaller, the sight moves upward.
How can I make the grip’s C0 tween properly while considering the FieldOfView at the moment aiming down sights is completed (for example, 30)?
Below is the Aim Down Sight code I am currently using in my gun kit:
local ray = cws.camera:ScreenPointToRay(cws.mouse.X, cws.mouse.Y, 0)
local offset = ads.CFrame:ToObjectSpace(CFrame.new(ray.Origin, ray.Origin + ray.Direction)).Position
grip.C0 = cws.origin.grip_c0
cws.services.ts:Create(
grip,
TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{C0 = grip.C0 * (cws.weapon.info.ads_offset or CFrame.new(offset.X, offset.Y, offset.Z))}
):Play()
This is the first time I have encountered this type of problem. After sitting in front of the monitor and struggling for 4 and a half hours, I have barely managed to find the cause.
I would appreciate even a simple suggestion!
70 FieldOfView:
10 FieldOfView: