# LookRotation flipping 180 degrees through y axis

I have LookRotation to rotate some points as the move through space, and when it crosses the Y axis it rotates by 180 degrees, sometimes 120, so there is an error in the mesh.

this is the rotation code i am using:

``````function rotatem ( origVerts: Vector3 ):Vector3 {
var rotation = Quaternion.LookRotation(line(steps+0.1)-line(steps-0.1), Vector3.up);
//rotation *=Vector3(0,1,0);
var translation: Vector3=Vector3.zero;
var scale = Vector3(1, 1, 1);
var newVerts: Vector3 ;
//var rotation = Quaternion.Euler(0, Time.time%199, 0);
var m = Matrix4x4.TRS(translation, rotation, scale);

newVerts = m.MultiplyPoint(origVerts);

return newVerts;
}
`````` The answer is as RobertBu said. I have to define the LookRotation() second variable to be something relative to where it was pointing to recently… if i point the LookRotation() second variable to exactly 90’/-90 it stays completely straight, otherwise 95 degrees it goes corkscrew. If it’s a square toothpase i can’t control it yet, it’s kindof pointing randomly depending on recent curve. A next challenge will be have straight and to control the rotation of square so that i can have some kinds of floor and walls.

many many thanks RobertBu, i love you 