# rotating eyes without gimbal lock kinda problem?

## Recommended Posts

whassap,  im trying to build a setup where you build a eye rotations, but the problem i find with is that rotate() which seems to be the more viable way,  presents 2 challenges when i try to use it:

1.-  using the axis normally and rotating with radians:  i dont know how to do a smooth interpolations in the axis to turn the eye whichever i want.

2.- using the axis to align the eye  so you  just playing around with radians: causes a snap effect, that reminds me the gimbal lock like issues, and thats the case of this example from @mestela

if you look each eye is "snapping" because the axis determines the orientation,  or im wrong?

so do you know how to rotate at which ever direction with very smooth interpolation?

im trying this type of things:

```
v@inidir = set(0,0,1);
v@pt = point(1,"P",0);
3@ident = ident();
3@secdir = dihedral(@inidir,@pt);
f@dist = 1-distance(@P,set(0,0,0));
3@sl = slerp( @ident, @secdir, @dist);
p@orient = quaternion(@sl);
matrix xform;
@N = 0;
float scale = 1;
float postrotation = 0;
xform = instance( @P, @N, scale, postrotation, @orient, @pivot);
@P *= xform;

```

as you can see in the code,  im trying to rotate with dihedral and with a falloff decay effect,  and then using instance to set up a pivot,  but this isnt working.

this isnt giving the answer because dihedral() and lookat() by it self arent the full matrix set up, but then which one is the apropiate set up?

and all this is not because the eye itself, but the eyelids,  basically the question is how do you setup eyelids in a procedural way?,  because they belong to the full mesh,  but have to be transformed with a very smooth falloff,  and im not using blend shapes because im not using skeletons,  is part of a procedural crowd.

Edited by dyei nightmare

##### Share on other sites

im kinda finding an answer, and yes based on the file

##### Share on other sites

another problem is instance() vex function distorting gemetry,   mestela says here that you have to normalize, but that doesnt fix the problem in some cases

##### Share on other sites

the answer to this was:  the snapping is because it is being multiplied by 0 for a short period , so that causes a blank space where noise is not there,  but at first glance you could think it is because the axis shouldnt be controled like that,  and this is kinda the reason, but it can be a disipated a lot with diferent angle values.

## Create an account

Register a new account