Orbit behavior script interface

The IOrbitBehaviorInstance interface derives from IBehaviorInstance to add APIs specific to the Orbit behavior.

Orbit behavior APIs

setTargetPosition(x, y)
Set the position in the layout that the movement will orbit around.
Return the current target position in the layout as a two-element array in the form [x, y].
Pass an IWorldInstance to set the behavior to always orbit around that object's position.
Set or get the current rotation speed in radians per second.
Set or get the current rotation acceleration in radians per second per second.
Set or get the current orbit position by its angle relative to the target position in radians.
For elliptical orbits, set or get the rotation of the ellipse in radians. For circular orbits, this does not affect the orbit path (since rotating a circle has no effect), but it changes the initial angle the orbit starts from.
Set or get the distance of the orbit from its target position. The primary radius is in the direction of the offset angle, and the secondary radius is perpendicular to the offset angle. For a circular orbit set both values to the same radius; for an elliptical orbit set them to different values.
Set or get a boolean indicating if the behavior will also alter the object's angle to match the direction of travel.
Set or get the total accumulated rotation in radians. These values do not wrap upon completing a full rotation. The totalRotation value will decrease for counter-clockwise rotation, whereas totalAbsoluteRotation increases regardless of the direction of rotation.
Return the distance from the object to the target position.
A boolean indicating if the behavior is enabled. If disabled, the behavior no longer has any effect on the object.
Construct Animate Manual 2022-08-31

On this page