Hello, I’m looking to program the logic for the following and have been struggling greatly:
I hope to have an eye attached to a body (think your eyeball and your neck) that follows a given target. The eye should be the only thing moving whenever possible (when the target is inside of given bounds, my attempt used the horizontal angle and a limit there), but if the target leaves those bounds the “neck” should move slightly in the direction of the target to allow the eye to view it while within its constraints.
The neck should not move vertically, only horizontally. The eye will be hard constrained vertically.
This system is to prevent the eye from looking backwards into what is covering it.
I’ve experimented with everything I could think of and almost got it working. The problem I ran into was when you walked behind the original orientation of the eye (crossing a 180 degree plane), the neck stopped following temporarily before resuming, but the eye looked in the right spot on the opposite side.
I’m not experienced enough in CFrame math to solve this. Hoping to find someone who is.