# Bend by Object

Bend by Object allows you to change the angle of scattered items so that they rotate away or towards a selected object. It's ideal for illustrating objects interacting with grass or rugs with many other possible applications. To use it:

- Use the
**Object**property to select an object from the scene that will be used to affect the angle of scattered items. - Use
**leanOutAmount**to change the amount objects will bend. Negative values lean away from the object and positive values lean towards the object. - Use
**leanOutDistance**to control the distance from the object that the angle change affects. The effect will falloff until it reaches this distance. - Use
**randomWiggle**to add some rotation variation to the items that are affected by the bend effect.

## Effect Script:

Vector vec1 = object.position - fpItem.position; real angle = atan2(vec1.x,vec1.y)-degtorad(90); real lengthVec = length(vec1); real leanOutX = easeIN( length(vec1),Lean_Out_Distance,0,fpItem.rotation.x,sin(angle+degtorad(randomReal(-randomWiggle,randomWiggle)))*Lean_Out_Amount); real LeanOutY = easeIn( length(vec1),Lean_Out_Distance,0,fpItem.rotation.y,cos(angle+degtorad(randomReal(-randomWiggle,randomWiggle)))*Lean_Out_Amount); fpItem.rotation.x = leanOutX; fpItem.rotation.y = leanOuty;

You can find this Effect within the Forest Effects Library.

## This Effect Uses:

### Parameters

**Object**

Type: Object**Lean_Out_Amount**

Type: Real**Lean_Out_Distance**

Type: Scene Units**RandomWiggle**

Type: Real

### Attributes

**fpItem.areaIncNearest**

Vector to nearest include area edge.**fpItem.areaIncDistance**

Distance to nearest include area.**fpItem.position**

Position vector of individual fp Item.**fpItem.rotation.x**

Individual item's X rotation.**fpItem.rotation.y**

Individual item's Y rotation.

### Functions

- length(v)

The length of v. **atan2(x,y)**

Returns the principal value of the arc tangent of y/x, expressed in radians**degToRad(p)**

Converts degrees to radians.**easeIn(x,x1,x2,y1,y2)**Returns an ease-in interpolation between y1 and y2. Returns y1 when x < x1