Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Introduced in

Version:1.00

Description

Description:
Set
Sets the velocity (speed vector) of a vehicle.
Units are in meters per second.

Syntax

Syntax:vehicle setVelocity
[x, y, z]
 velocity
Parameters:
[x, y, z]
  •  - Affected vehicle.
  • velocity: Vector3D -
Acceleration
  • Velocity in [x, y ,z]
.
  • (in V2.15+
:
  • [0,0,0]
will stop
  • stops the vehicle).
Return Value:Nothing

Examples

Examples:
_truck1 setVelocity [20, 0, 0];

Advanced method used for relative acceleration:

_vel = velocity _vehicle;

_dir

=

direction

_vehicle;

_speed

=

10;

//

Added

speed;


_vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)];

Additional Information

See also: velocity, setVelocityAng, setThrustWanted
Multiplayer:
 

Problems:
 

Notes





Posted on May 28, 2015
David Markwick
Will require a sleep of at least 1 frame between any positioning (including creation of, or otherwise moving with a setPos variant) and this command.