obj.ApplyVelocity() - originalfoo/Prison-Architect-API GitHub Wiki

##Overview

The .ApplyVelocity() method can be used to create a shunt of movement (and optionally some rotation) in a specific direction.

##Syntax

someObj.ApplyVelocity( <velX>, <velY> [, <rotate>] )

Where:

  • <velX> and <velY> are numbers defining the velocity along the x and y axes respectively
    • Positive <velX> is North, negative is South
    • Positive <velY> is East, negative is West
  • <rotate> is an optional parameter; if true then it will apply some mild rotation
    • defaults to false

##Example

someObj.ApplyVelocity( 2.0, 5.0, false )

##Notes

Rotation, if used, will be applied around the centre of your object. If you update the rotation whilst the animation is active, the animation will stop instantly.

The velocity values are applied from a south-facing perspective (ie. ignoring any rotation of the object). If you update the velocity whilst it is being animated, it will continue to be animated but the rotational animation (if applied) may be lost.

##See Also

⚠️ **GitHub.com Fallback** ⚠️