# Continuous rotation to see all sides of a mesh

Care to give it a try? The section I need help on is commented in this playground (starting around line 40)

I want to continously rotate a mesh so that all sides rotate towards the viewer before any side is repeated. Or approximately so.

My first thought was to use two rotations. If both use local or both use world coordinates, then I think it reduces to rotation around a single axis. (Does it? I’m not sure.)

My next thought was to try rotating around a world axis, then rotate around a local axis. This works a lot better, but then it sort of wobbles and the rotation speed varies, I think because occasionally the world and local axis rotations are fighting each other.

The best I have is using a world axis and a local axis while zeroing out the local axis component that matches the world rotation.

I’ve tried rotation speeds without a common denominator so there is less repeating.

Can you help? Try modifying the playground and let me know what you come up with.

my favorite rotation demo from the docs (searched for “coordinate”) :

Use TransformCoordinates to Place Sphere | Babylon.js Playground (babylonjs.com)

Is this what you need?

Not quite. The top and bottom don’t quite face the viewer. On a polyhedron with a lot of sides, some of the sides still are only viewable at a very oblique angle. I need all sides to more directly face the camera during the rotation.

may be the solution is easer as you think…

if you like to see all horicontal sides just do box.rotation.x += 0.01;

if you like to see all vertical sides just do box.rotation.y += 0.01;

if you combine both rotations you’ll see all sides

rotate box and see all sides | Babylon.js Playground (babylonjs-playground.com)

It’s hard to see without numbered sides, but at least one side doesn’t sufficiently face the camera. Modifying y += 0.015 makes it work well! I appreciate you pulling me back to simple.

1 Like