#Hello guys
1 messages ยท Page 1 of 1 (latest)
Your rotation order may be wrong. Try apply your euler angles first then multiply LookRotation.
I am sorry, I didn't get it well, could you please elaborate on this a little bit more?
leftEye.transform.rotation = Quaternion.Euler(10, 90, -13) * Quaternion.LookRotation(camera.transform.position - leftEye.transform.position);
wow, I tried it out, it didn't work;
The iris did follow the camera, but it only could rotate in one axis, when I changed the adjusted values, it moved diagonally or by a curve...
but it only could rotate in one axis
What does this mean? It'd be better if you take a video or something
Also think about creating parent object for eyeball and rotating child to match iris with Z axis if you don't want that magic number.
Okay give me a couple of minutes, i'll take some screenshots
private Vector3 leftAdjust = new(0, 80, -10);
private Vector3 rightAdjust = new(0, 98, 2);
protected void _Eyes()
{
leftEye.transform.LookAt(this.transform);
leftEye.transform.Rotate(leftAdjust);
rightEye.transform.LookAt(this.transform);
rightEye.transform.Rotate(rightAdjust);
//Quaternion q = Quaternion.LookRotation(this.transform.position - leftEye.transform.position, Vector3.forward + Vector3.right);
//leftEye.transform.rotation = q;
}
this.transform is the camera
Now, I'll take screenshots with what you suggested
now I simply adjust camera, pause the game, and take screenshots
camera is above the head
camera is below the head
but if I move down to the right
I hope you got what I meant when I said "rotates only in one axis"
Alright so the order seems right with this one, forget what I suggested. ๐
You said the problem is eyes are "somewhere ahead of the camera"
Does that mean the second screenshot seems like looking more left than the camera?
yes, exactly
but I think it's fixable, I just need to put a boundary so that eyes don't turn further from it
Hm. Did you consider another suggestion to make eyeball as child object?
If you make an anchor object and matches eyeball to look Z axis
Then you can rotate parent object with LookAt
Or maybe your eyeball is too big
So it's center is not actually eye's center
I didn't try that one yet, let me take a look at it
Sounds like a genius idea, I hope it'll work out the same way it did in my imagination ๐
Hopefully
@grand venture
Hey man, I put it inside an empty gameobject, now it looks okay, maybe slightly better than my first screenshots
now, could you please suggest me anything related to limiting the eye movement?
I was thinking about an if statement that checks for the camera position, if it exits some boundaries, it'll simply not turn eyes towards it.
However the problem arises when you put camera closer to the model, then those boundaries are no longer valid.
Would be glad to receive any ideas
You could check the angle instead of distance?
dang, you're smart!))
Thanks man, really appreciate that,
Bought you a coffee ๐ Let me know if you received everything
Thanks! ๐ I appreciate it
Let me know if you have more issue
@grand venture Good morning (I hope it's morning in your time zone)
I implemented eye movement, it works almost exactly as intended, but a little thing I miss is the smoothness
I limited the eyeball rotation so that eyes look a little more natural when the camera moves on the sides.
However, let's say user(=camera) makes a circle around the model clockwise, he'll pass through the right side and appear on the left.
When eyes reach the right border, they become fixed, and when user appears on the left, eyes jump to the left side
This kind of jumps make eyes appear a little awkward, so I want to smooth their movement out.
Do you have any ideas on how to do that?
// Make eyes look at the camera
protected void _Eyes()
{
// Reference direction of the gaze
refDirectionLeft = _v3OldCamPos - leftEye.transform.position;
refDirectionRight = _v3OldCamPos - rightEye.transform.position;
// Actual direction of the gaze
directionLeft = this.transform.position - leftEye.transform.position;
directionRight = this.transform.position - rightEye.transform.position;
// Angles between actual and reference directions
angleLeft = Vector3.Angle(refDirectionLeft, directionLeft);
angleRight = Vector3.Angle(refDirectionRight, directionRight);
if (angleLeft < limit)
leftEye.transform.LookAt(this.transform);
else if (angleLeft > limit * 3)
leftEye.transform.LookAt(_v3OldCamPos);
if (angleRight < limit)
rightEye.transform.LookAt(this.transform);
else if (angleRight > limit * 3)
rightEye.transform.LookAt(_v3OldCamPos);
}
Evening here ๐ There is Quaternion.Slerp or Quaternion.RotateTowards you could use to interpolate between rotations
Good evening then ! ))
Thanks for the advice, I will take a look at those
YOOOOOOOOO HOOOOOOOOOOOOOOUUUUUUUUUUU
bro thank you very much!!
now it does look like a real human eyes when they move
Quaternion.RotateTowards did the trick, though I have to optimize because my code is doing many unnecessary calculations
@grand venture thanks a lot!
Good job ๐ make a great game