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

##Overview

This method behaves the same as the .ApplyVelocity() method exposed by an individual object. The main difference, is that this version accepts an optional parameter indicating which object to call the function on. If omitted, the function is called on this. It is generally recommended to use .ApplyVelocity() in preference of this function, for the sake of script clarity.

##Syntax

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

Where:

  • <someObj> is an optional parameter; if an object reference is specified, this function will behave identically to someObj.ApplyVelocity()
  • <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

local someObj = Object.Spawn( "MyObject", 5, 5 );
Object.ApplyVelocity(someObj, 2.0, 5.0, false )

##Notes

Rotation, if used, will be applied around the center 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

.ApplyVelocity()

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