I’m struggling to get my head around the rotation of my object.
I’m trying to make an Eye Ball system, that blinks, and has emotion that is done via a hemisphere (eye lid).
The blink (open/close of the hemisphere) is a rotation from 0 to -180 set on the X rotation axis. This works fine:
[Range(0f, 1f)]
public float _eyeClosed = 1f;
void UpdateEyeLids(){
float _blink = (180 * _eyeClosed);
_leftLid.eulerAngles = new Vector3(-_blink, 0, 0);
_rightLid.eulerAngles = new Vector3(-_blink, 0, 0);
}
So when my Range is set to 0, the eye is fully open, and when set to 1, the eye is fully closed. Like I said, this works perfectly.
However, the problem occurs when I want to add another rotation into the mix, locally, on the Y axis which is used for emotion (angry/sad). If I remove the blink system, and replace it with my emotion system, it works fine:
//-1 Sad | 0 Normal | 1 Angry
[Range(-1f, 1f)]
public float _eyeEmotion = 0f;
void UpdateEyeLids(){
float _emotion = (60 * _eyeEmotion);
_leftLid.eulerAngles = new Vector3(0, _emotion, 0);
_rightLid.eulerAngles = new Vector3(0, -_emotion, 0);
}
The problem is trying to mix to two together, simply doing this…
_leftLid.eulerAngles = new Vector3(-_blink, _emotion, 0);
_rightLid.eulerAngles = new Vector3(-_blink, -_emotion, 0);
… does not work; as the axis are now out of place when I change the Range of Close, and Emotion. Blink is no longer on the X axis, and Emotion is no longer on the Y axis.
I believe for it to work, I need the BLINK to occur on the X axis locally, and the EMOTION to occur on the Y axis world.? Maybe…