user5839 user5839 - 8 months ago 46
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?


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;