jagenjo / webglstudio.js

A full open source 3D graphics editor in the browser, with scene editor, coding pad, graph editor, virtual file system, and many features more.
MIT License
5.22k stars 606 forks source link

How to animate a model to turn to a position such that it always shows a particular side of the model? #53

Open KnightCoder opened 4 years ago

KnightCoder commented 4 years ago

Lets say that I've a model of an animal and the user rotates the animal in any direction but once the user clicks a button "Turn to show face" the 3D model should animate turning to show the animal's face, no matter in which angle it was rotated previously by the user.

How can I achieve this? Is there a function/property where we can set lets say the absolute angle (not relative angle) value?

KnightCoder commented 4 years ago

I noticed a transform.orientTo method. I even tried this it turned the model but it didn't animate the turning. Is this method correct? If yes, how can I make it animate the turn? Can you please give a short example?