# BoneLookController Attitude limitation problem

gaze | Babylon.js Playground (babylonjs.com)
In this case, I wanted to set Yaw less than -160 and greater than 160 to limit the lateral deviation of the eyeball, but I couldn’t?
The BoneLookController receives the minimum and maximum values of the options passed in, if they are greater than the minimum and less than the maximum.

hmmm you want to limit the angle of the eye bones so the pupils never disappear right? @bghgary @Evgeni_Popov any idea how can this be done?

Yes, I would like to limit the pupil yaw value, yaw < -160 || yaw > 160, but now its rules don’t seem to allow.
Modifying adjustYaw didn’t get the effect I wanted, causing the pitch to move in the opposite direction.

In your case, you need the yaw value to be either between [160°,180°] or [-180°,-160°]. Or, if using the absolute value of yaw, it is simply [160°,180°].

I have created a PR that allows you to use the absolute value of yaw instead of yaw when checking the constraints:

When the PR is merged, this PG will work (look for `useAbsoluteValueForYaw` in the `options`):

2 Likes

Thanks for the reply, and the PR, but there are still issues with using absolute values.
I use a diagram to describe the problems that may arise.
Because the yaw value is a ring, can we determine whether the range of the yaw limit is above or below the ring by judging the size of min versus max?
Here are some of my thoughts.

The PR will make your PG work the way you want it to, so that’s at least a step in the right direction .

I think the most general solution would be to be able to define several ranges for the yaw constraint (and pitch, for that matter) - [160°,180°] + [-180°,-160°] in your case. That’s what I tried at first, but I’m not familiar enough with the code and how it works, so I tried the “absolute value” route and was pleased to see that it worked!

1 Like

This should be the perfect solution.