Skip to main content

Look At object with Falloff

Overview

Look At object with Falloff allows you to rotate items to look at a specified object and additionally specify a falloff range so that only items within a certain radius of the object are affected. To use it.

  1. Use the Effects > lookAt parameter to pick the look at target from the scene.

  2. Use the Effects > falloffDistance parameter to specify the falloff for the look at effect.

Effect Script

vector v = Lookat.Position - fpItem.Position;
fpItem.rotation.z = easein(length(v),falloffDistance,0,fpItem.rotation.z, -atan2(v.x, v.y));

You can find this Effect within the Forest Effects Library.

This Effect Uses

Parameters

  • falloffDistance

    Type: Scene Units

  • lookAt

    Type: Object

Attributes

  • fpItem.position

    Minimum Z rotation as set in the Transform rollout.

  • fpItem.rotation.z

    Rotation of Forest Item on Z axis in local coordinates.

Functions

  • easeIn(x,x1,x2,y1,y2)

    Returns an ease-in interpolation between y1 and y2. Returns y1 when x < x1.

  • length(v)

    The length of v.

  • atan2(x,y)

    Returns the principal value of the arc tangent of y/x, expressed in radians