derricksimpson / Three.js-Object-Rotation-with-Quaternion

Rotate and object, not camera, using quaternion rotation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Three.js-Object-Rotation-with-Quaternion

Example of rotating an object, not camera, using quaternion rotation.

I was looking for ways to rotate an object, not the camera, in a 3d scene using a trackball like control. I found code on StackOverflow which was very close to what I was looking for. This is that example code updated to work more like I wanted.

The rotation now works as I expect. Phew.

Now with momentum Try spinning the cube fast.

Putting this code out there in case it helps anyone or could be improved.

View an example here: http://projects.defmech.com/ThreeJSObjectRotationWithQuaternion/

About

Rotate and object, not camera, using quaternion rotation.


Languages

Language:JavaScript 90.8%Language:HTML 9.2%