top of page

360 Degree Rotation Angles

Verge3D rotation values are a bit confusing and often make it difficult to determine if a specific angle has been achieved. The Verge3D rotational coordinate system is based on 0 to +180 and then -180 to 0 to complete a full revolution of 360 degrees. As a 3D artists this is not what I expect and I often need it to be values between 0 and 360 degrees.

The diagram above shows how the get object rotation puzzle provides rotation values indicated in blue. The GetAngle procedure you can copy from the video or DOWNLOAD here provides angles measurements from 0 to 360 degrees, which comes in very handy, at least in many of my projects.

This procedure allows you to not only get the output in terms of 0 to 360 degrees but also allows you to count/determine the number of turns an object has been rotated and allows you to change the sign of the values to match the direction of the turn you desire.

The Procedure:

The procedure has two parts...the calculation of the angle from 0 to 360 and then the determination of the direction of rotation.

The first thing it does is store the Objects angle from the get Object rotation puzzle into a variable "retrieved_angle".

Next we calculate the modulus. In Verge3D the modulus is calculated using the "remainder of" puzzle. This will give us the angle of the rotation from 0 to 360 degrees.

The next part calculates the number of complete revolutions or turns. It has to determine which direction the object is rotating to determine whether to subtract or add the incremented value.

We then determine which direction the rotation is occurring...clockwise or counter clockwise. The variable names are arbitrary and could have been, left right, positive, negative, A or B, they are simply recording a state of direction.

We test two conditions: if the previous angle is negative and the retrieved angle is postive. This defines a situation where the value are at a cross over point near 0.

Depending on the conditions we can determine the direction the object is rotating in and increment or decrement the rotation count.

We then set the previous angle to the retrieved angle and return the accumulated value.

A multiply by -1 or 1 will set the sign of the accumulated value so that the values will shift according to your desired direction or rotation.

23 views0 comments


bottom of page