Strange behaviour when using lookat()

(Rawinteractive) #1

Hi all,

I'm having an issue with the Viewer API. I need to move the shoe from the Left position to the Top position using lookAt() but the movement is strange. In the Top position the toe of the shoe should be pointing to the right.


Please see:

Clicking Left and then Top shows the problem. Its moving in stages because I am programatically triggering the click multiple times to help it get around! If you click enough times the shoes ends up in the position I want.

The other views seem fine. Any ideas would be appreciated.


(Shaderbytes) #2

I can get it to work in my api utility example :

I have no idea how you are doing your code , but my API utility uses the object being looked at and derives the camera lookat relevant to the object.

Having experience programming 3D stuff it is a known thing for the camera to "flip" when crossing over the 180 degree X axis rotation value , if it didnt then the camera would be upside down on the other side of 180. I presume in your code you are crossing the yz plane causing the x value sign to be inverted, this then causes the lookat function to calculate a rotation above 180 degrees and so you get a camera flip.

(Rawinteractive) #3

Thanks for your help, your example really helped us to solve this. Appreciate it!

(Shaderbytes) #4

Awesome , glad It was helpful.