user5839 - 4 months ago 31

Javascript Question

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;
```