global_acceleratedMovement.scr

Dependencies

#include "maps/global_scripts/global_common.scr"
#include "maps/global_scripts/global_math.scr"

Purpose

Commands that move objects in accelerated ways

How To Use

Call these functions on a script object or script model in your level passing the desired parameters.

External Functions

globalAccelMove_AxisAligned( entityName, totalTime, totalDistance, moveDirection )

Purpose:
Moves a script object with acceleration along an axial path (up, down, north, south, east, west) ADDENDUM - This is the older method, you should use the new acceleration commands listed below

    Parms:
  • entityName (string)
    The targetname of the script object to accelerate with no '$' in the name.

  • totalTime (float)
    The total time it should take to move its distance.

  • totalDistance (float)
    Tthe distance it should move on it's choosen axis.

  • moveDirection (string)
    The axial direction to move .
    • up - moves the object up
    • down - moves the object down
    • north - moves the object north
    • south - moves the object south
    • east - moves the object east
    • west - moves the object west

globalAccelMove( entObject, vecMove, fltTime, strCurve, strSound )
globalAccelMoveX( entObject, fltDistance, fltTime, strCurve, strSound )
globalAccelMoveY( entObject, fltDistance, fltTime, strCurve, strSound )
globalAccelMoveZ( entObject, fltDistance, fltTime, strCurve, strSound )

Purpose:
Move an object using one of 3 acceleration curve types in absolute directions. This means using North, South, East, West movement commands rather than relative movement commands.

How to setup:
Make a script model or object that you wish to use. Call one of these functions on it. If you want to wait until the move is finished before proceeding in your script, call this function in-line. If you would like your script to progress and not wait, then call this function with the 'thread' command.

    Parms:
  • entObject (entity)
    The script object to move with acceleration.

  • vecMove (vector)
    The distance to move for X, Y, and Z axis. You enter the distance you want the object to move on all 3 axis from it's current position. So X handles the East/West motion, Y handles the North/South motion, and Z handles the Up/Down motion.

    Positive X is East, negative X is West, positive Y is North, negative Y is South, positive Z is Up, negative Z is Down. Syntax for vectors are 'x y z' with the apostraphe's. So as an example, a value of '512 -256 64' will make the object move East 512 units, South 256 units, and Up 64 units.

    OR

    fltDistance (float)
    ONLY when using one of the single axis commands, just pass the distance for that axis only.

  • fltTime (float)
    The time to take for the move, just like the .time parameter on an object.

  • strCurve (string)
    The acceleration curve to use, there are 3 options:

    • rampup - this will make the object start from still and ramp up to it's maximum velocity
    • rampdown - this will make the object start at maximum velocity and slow down to still
    • rampupdown - this will make the object start from still, ramp up to it's maximum velocity, the slow down to still again
    • "none" - this will make the object move linearly (with no acceleration)

  • strSound - string, a path to the sound to play on this object as it moves. The sound will start playing the moment it moves. Entering "" will play no sound.

globalAccelMove_Relative(entObject, vecMove, fltTime, strCurve, strSound)
globalAccelMove_RelativeX(entObject, fltDistance, fltTime, strCurve, strSound)
globalAccelMove_RelativeY(entObject, fltDistance, fltTime, strCurve, strSound)
globalAccelMove_RelativeZ(entObject, fltDistance, fltTime, strCurve, strSound)

Purpose:
Move an object using one of 3 acceleration curve types in a relative movement. This means using Right, Left, Forward, Backward movement commands. The forward direction is determined by the 'angle' keyvalue set on the object. ADDENDUM: Relative movement commands only work on an objects horizontal axis, or straight up / down. This means that you can not face an object South and Down and expect it to move Forward in that direction. It would only move forward on it's horizontal axis, but not Down.

How to setup:
Make a script model or object that you wish to use. Call on of these functions on it. If you want to wait until the move is finished before proceeding in your script, call this function in-line. If you would like your script to progress and no wait, then call this function with the 'thread' command.

    Parms:
  • entObject (entity)
    The script object to move with acceleration.

  • vecMove (vector)
    The distance to move for X, Y, and Z axis. You enter the distance you want the object to move on all 3 axis from it's current position. So X handles the Right/Left motion, Y handles the Forward/Backward motion, and Z handles the Up/Down motion.

    Positive X is Right, negative X is Left, positive Y is Forward, negative Y is Backward, positive Z is Up, negative Z is Down. Syntax for vectors are 'x y z' with the apostraphe's. So as an example, a value of '512 -256 64' will make the object move Right 512 units, Backward 256 units, and Up 64 units.

    OR

    fltDistance (float)
    ONLY when using one of the single axis commands, just pass the distance for that axis only.

  • fltTime (float)
    The time to take for the move, just like the .time parameter on an object.

  • strCurve (string)
    The acceleration curve to use, there are 3 options:

    • "rampup" - this will make the object start from still and ramp up to it's maximum velocity.
    • "rampdown" - this will make the object start at maximum velocity and slow down to still.
    • "rampupdown" - this will make the object start from still, ramp up to it's maximum velocity, the slow down to still again.
    • "none" - this will make the object move linearly (with no acceleration)

  • strSound (string)
    A path to the sound to play on this object as it moves. The sound will start playing the moment it moves. Entering "" will play no sound.

globalAccelMove_Rotate( entObject, vecMove, fltTime, strCurve, strSound )
globalAccelMove_RotateX( entObject, fltDistance, fltTime, strCurve, strSound )
globalAccelMove_RotateY( entObject, fltDistance, fltTime, strCurve, strSound )
globalAccelMove_RotateZ( entObject, fltDistance, fltTime, strCurve, strSound )

Purpose:
Rotate an object using one of 3 acceleration curve types.

How to setup:
Make a script model or object that you wish to use. Call this function on it. If you want to wait until the move is finished before proceeding in your script, call this function in-line. If you would like your script to progress and no wait, then call this function with the 'thread' command.

    Parms:
  • entObject (entity)
    The script object to rotate with acceleration.

  • vecMove (vector)
    The rotational distance in degrees on X, Y, and Z axis. Positive or negative controls the direction (positive is counterclockwise, negative is clockwise). Syntax for vectors is 'x y z' (with the apostrophes).

    OR

    fltDistance (float)
    ONLY when using one of the single axis commands, just pass the distance for that axis only.

  • fltTime (float)
    The time to take for the move, just like the .time parameter on an object.

  • strCurve (string),
    The acceleration curve to use, there are 3 options:

    • "rampup" - this will make the object start from still and ramp up to it's maximum velocity
    • "rampdown" - this will make the object start at maximum velocity and slow down to still
    • "rampupdown" - this will make the object start from still, ramp up to it's maximum velocity, the slow down to still again
    • "none" - this will make the object move linearly (with no acceleration).

  • strSound - string, a path to the sound to play on this object as it moves. The sound will be start playing the moment it moves. Entering "" will play no sound.

globalAccelMove_Pendulum( entObject, vecMove, fltTime, fltFriction, strSound )

Purpose:
Swings an object back and forth on the desired axis in a pendulum motion.

How to setup:
Position and orient your script object in what would be the dead center position (the bottom of the swing). Don't forget to have an origin brush on the object if it's a script object. For a script model, bind it to a script origin, then pass the script origin into this function)

    Parms:
  • entObject (entity)
    The script object to perform the pendulum motion on vecMove - vector, this is the amplitude of the pendulum swing per axis (half the total arc) in degrees. So if you enter a value of 15 degrees on one axis, the full swing will be 30 degrees on that axis. Syntax for vectors is 'x y z' (with the apostrophes).
  • fltTime (float)
    The total time it takes to perform one full swing (from one extreme, to the other extreme, and then back to the first extreme again).

  • fltFriction (float)
    This is a percentage value between 0 and 1. This is the percentage of the amplitude that will be subtracted from the swing each time the object passes through it's starting position. Enter a value of 0 for infinite (frictionless).

  • strSound (string)
    A path to the sound to play on this object as it swings. The sound will be played each time the object is at it's maximum outer extents and swings on down to center.