user5839 user5839 - 22 days ago 6
Javascript Question

Change order of placement on circle

I've placed a load of items in a circle around a camera, and the objects appear in a counter-clockwise direction with this code

answer.position.y = Math.sin(answerBoxRadians) * circleRadius;
answer.position.z = Math.cos(answerBoxRadians) * circleRadius;
answer.rotation.x = Math.PI - answerBoxRadians;


How do I reverse the math so they appear in a clockwise direction?

Answer

It's because positive angle is counter-clockwise. Put your angle as negative and you'll get the order in clockwise.

answer.position.y = Math.sin(-answerBoxRadians) * circleRadius;
answer.position.z = Math.cos(-answerBoxRadians) * circleRadius;