user5839 user5839 - 1 year ago 88
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 Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download