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

Introduced in



Description:Calculates the edge of a given vehicle or object based on an iterative collision calculator.


Syntax:[vehicle, multiplier, start_position, step_size, lod, radius, return_type, warningMsg] call fn_vbs_findEdge
  • vehicle: Object - The vehicle.
  • multiplier: Number - Multiplies each component of the step size array, can also be code-driven. If code is used, the useful parameters in the code are (the code must return a number): _iteration (iteration step array), _position (current model position array), _x (current axis) (optional, default: 1).
  • start_position: Array - Where to start the iterations from (in model coordinates) (optional, default: [0,0,1]).
  • step size: Array - How far to iterate each step (optional, default: [0.25,0,0]).
  • lod: String - Which LOD to consider for testing (the same as those available for the cylinderCollision command) (optional, default: "VIEW").
  • radius: Number - The radius considered around each iteration step (optional, default: 0.5).
  • return_type: Number - The values can be:
    • 0 - Model coordinates
    • 1 - World coordinates (AGL)
    • 2 - World coordinates (ASL) (optional, default: 0).
  • warningMsg: Boolean - Enables / disables warning messages (optional, default false).
Return Value:Array - Either model space, world space AGL, or world space ASL, depending on the request. The position is the final step where there was a collision with the model.


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.


Returns the front of the player vehicle (in the Geometry LOD):
[vehicle player, 1, [0,0,1], [0,0.25,0], "GEOM", 0.5, 0, false] call fn_vbs_findEdge; 
Has different multipliers on the Y-axis:
_mult = { if (_x == 1) then { _ret = 0.5 }; _ret; };
[v1, _mult, [0,0,1], [1,1,0]] call fn_vbs_findEdge; 
Returns world coordinates (AGL) and checks over a smaller radius:
[v1, 1, [0,0,1], [0,0.25,0], "", 0.1, 1] call fn_vbs_findEdge;

Additional Information

See also: cylinderCollision