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

Oh you might want to add a part for the red aiming thing, just like a real gun. It’d be more realistic

I don’t know what you mean by that but the weapon is attached to the viewmodel perfectly fine. Just how I offset the camera is wrong and I don’t know whats wrong about it.

1 Like

I don’t really want red dot sights on my guns. And when I have added them they’re also off-centered.

I think you just need to get the camera offset or animation perfect. There’s no easy way out I think

There is no aim animation. Its procedural.

1 Like

Not sure, you Usually use CFrame:Lerp to aim a viewmodel as it is more Linear with CFrame while TweenService Performs a type of Animation with the given TweenInfo, but is less accurate doing so

Do you use a part that’s connected to the gun?

image
Perfectly aligning it does this.
Don’t know if you can see it but the iron sights aren’t centered.

1 Like

If the animation is procedural and im guessing the position of the gun is based on that, why not just put some offset on the procedural animaton?

Well, from the information I’m given, I think it’s a weird positioning issue. I do have one question though, and do you position your aim UI by doing 0.5,0,0.5,0 with an anchor point of 0.5,0.5? I know that’s a stupid question but that’s all I have left

1 Like

What I’m doing it offsetting the viewmodel to center the aimpoint. But this causes issues with the iron sights being off-centered.

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