Aim Down Sight is always off-centered and hard to center

As i stated, check your Weapons Orientation and Position, Try adding a Part insidethe Viewmodel, set its Position to the Weapon, Use that as the AimPart, and if it doesnt allign with the Sights, its likely your Weapons Orientation than the Script

When you’re calculating the dist value, and you use the primary part of the Arms model, is it just some invisible part that is being CFramed or welded in some way? If so, what to? The character head, or camera?

Its an invisible part that is being set to the camera cframe every frame.

Are the arm and gun models connected with a rig of some sort? Or all they all CFramed in relativity to each other? Another thing, does literally every gun have this centering problem?

The arms and gun models are all rigged. Only some guns have this issue and I got 0 clue why. I think its the way i calculated the offset.

I’d probably go with Cairo on this one. There might be some inconsistencies with the way you position the aim position attachments, such as some being in the front of the gun and some being in the back of the gun, or the gun’s orientation. It’s probably the models, not the code.

image

local dist = Arms.PrimaryPart.CFrame:ToObjectSpace(Arms.Client.Handle.AimPoint.WorldCFrame)
local rx, ry, rz = dist:ToEulerAnglesXYZ()
local distCF = CFrame.new(-dist.X,-dist.Y,0) * CFrame.Angles(-rx,-ry,-rz)
offsetTween = TweenService:Create(script.Offset, TweenInfo.new(0.25, Enum.EasingStyle.Quad), { Value = distCF })
offsetTween:Play()
---UPDATED CODE I ADDED ORIENTATION SO THERES NO ISSUES WITH ANIMATION OR ORIENTATION AS YOU SAID

How could it be my models if I perfectly center it and offset the orientation as well. The iron sights are still not centered.

I didn’t specify that it was gun models. Maybe it has something to do with the way your arms affect the gun. Try removing literally everything other than the gun, have some debug copy that’s just a floating gun that you can aim, see if the same problems occur or if something different happens even. Both would be fine.

There’s a lot of other factors here, one could be due to animations from a humanoid or animation controller, I would try checking there.

Otherwise I do not see an issue with the CFrame portion. The aim cframe is being tranlated relative to object space of the primary part “Root part”. Therefore it must be something else such as the model or additional animaitons in the Motor6D . Transform.

Bottom is my attempt at it with a similar set of code

2 Likes