Skip to main content

Stepped Rotation

Overview

Stepped rotation allows you to control to rotate the Z Rotation of forest items using a stepped increment. To use it:

  1. Go to the Transform rollout and enable Rotation.

  2. Enter a value for Z > Min and Z > Max is normal.

  3. Go to the effects rollout and enter the stepped increment value in degrees for the parameter named Z_Rotate_Step. The objects will now only rotate using increments of this angle.

Effect Script

real rotateRange = fpItem.randRotMax.z - fpItem.randRotMin.z;
real stepsInRange = floor(rotateRange/Z_Rotate_Step);
real ZRotation = randomInt(0,stepsInRange)*Z_Rotate_Step;
fpItem.rotation.z = degtorad(ZRotation);

You can find this Effect within the Forest Effects Library .

This Effect Uses

Parameters

  • Z_Rotate_Step

    Type: Real

Attributes

  • fpItem.randRotMin.z

    Minimum Z rotation as set in the Transform rollout.

  • fpItem.randRotMax.z

    Maximum Z rotation as set in the Transform rollout.

  • fpItem.rotation.z

    Individual item's Z rotation.

Functions

  • Floor(p)

    Lowers p to nearest whole number.

  • RandomInt(p,q)

    Generate a random integer between p and q.

  • degToRad(p)

    Converts degrees to radians. The opposite, radToDeg(p) is also possible.