Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.19

Description

Description:

Returns a position that is the specified distance and compass direction from the given position / object.

If an offset is specified, the final destination is also the offset, at a 90-degree angle. If the value is positive, the offset angle is 90 degrees; for a negative value, it is 270 degrees (V1.23+).

Syntax

Syntax:[point, distance, direction, offset] call fn_vbs_relPos
Parameters:
  • point: Object or Position-2 - Position to find relative to.
  • distance: Number - Distance away from point1.
  • direction: Number - Compass direction from point1.
  • offset: Number - Additional distance offset, at a 90-degree angle, added to the relative position.
Return Value:Position-2 - Relative position from point1.

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
// Finds a position 5m away from the player along azimuth 100
_pos = [player, 5, 100] call fn_vbs_relPos
// Starts at the position from the previous example, then moves 10m along azimuth 190, and returns this point
_pos = [player, 5, 100, 10] call fn_vbs_relPos

Additional Information

See also: fn vbs rotatePoint, fn vbs relativeModelPos
Multiplayer: 
Problems: 

Notes