Skip to main content

XY Local Translate

Overview

The translation controls found in the Transform rollout move each item on the world's XY axis. In contrast, this effect allows you to randomly move the object along each individual item's local axis. It also works in scene units instead of as a percentage of the object's size. To use it:

  • Use xOffsetStart to set a minimum X translation value, in scene units.
  • Use xOffsetEnd to set a maximum X translation value, in scene units.
  • Use YOffsetStart to set a minimum Y translation value, in scene units.
  • Use YOffsetEnd to set a maximum Y translation value, in scene units.

Effect Script

real angle = fpItem.rotation.z;
real randomOffsetX = randomInt(xoffsetStart,xoffsetEnd);
real randomOffsetY = randomInt(YoffsetStart,YoffsetEnd);
vector positionX = [cos(angle)*randomoffsetX, sin(angle)*randomoffsetX,0];
vector positionY = [cos(angle-degtorad(90))*(randomOffsetY), sin(angle-degtorad(90))*(randomOffsetY),0];
fpItem.position = fpItem.position+positionX+PositionY;

You can find this Effect within the Forest Effects Library .

This Effect Uses

Parameters

  • YOffsetStart

Type: Scene Units

  • YOffsetEnd

Type: Scene Units

  • YOffsetStart

Type: Scene Units

  • YOffsetEnd

Type: Scene Units

Attributes

  • fpItem.position

Position vector of individual fp Item.

  • fpItem.rotation.z

Individual item's Z rotation.

Functions

  • randomInt

Returns an integer random number in the range

a,b

  • degToRad(p)

Converts degrees to radians.

  • cos(p)

Cosine of p (p expressed in radians)

  • sin(p)

Sine of p (p expressed in radians)