How do i make an auto aiming gun that snaps to the visible area of a part?

Im trying to make an auto aiming gun but i dont know how to make the camera snap to a part or model’s visible area even when not viewing the center of the part, heres a example cause my explanations are bad

Part gets visible on screen
image

Aim there:
image

Not there:
image

I basically dont know how to detect another visible area of a part from the camera than the center and snap into that visible area

1 Like

Don’t exactly know if this will work, so please correct me if I’m wrong. :sweat_smile:

You could try detecting if the box is on the player’s screen with WorldToViewportFrame, and calculate the distance between the mouse and the box. If the mouse is close enough to the agrodistance, then you could turn the player’s camera CFrame by a couple of degrees/radiants. Hope this helps :cowboy_hat_face:

1 Like

i Think its WorldToViewportPoint, ill try using that for now and if i cant make the gun yet ill wait for another reply thanks

still cant ill wait for another solution