Difference between revisions of "lineIntersectsSurfaces"

From Bohemia Interactive Community
Jump to navigation Jump to search
(Please use notes properly. How To is next to Add New Note button)
(example updated)
Line 30: Line 30:
[[onEachFrame]] {
[[onEachFrame]] {
_ins = [[lineIntersectsSurfaces]] [
_ins = [[lineIntersectsSurfaces]] [
[[ATLToASL]] [[positionCameraToWorld]] [0,0,0],  
[[AGLToASL]] [[positionCameraToWorld]] [0,0,0],  
[[ATLToASL]] [[positionCameraToWorld]] [0,0,1000],  
[[AGLToASL]] [[positionCameraToWorld]] [0,0,1000],  

Revision as of 15:10, 13 August 2015

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 1.49|1.49]]
Hover & click on the images for description


Returns list of intersections with surfaces from begPosASL to endPosASL. If there is ground intersection, it is also included. Works on units. Works underwater. Doesn't return intersection with sea surface. Hardcoded max distance: 5000m.


lineIntersectsSurfaces [begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults]
[begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults]: Array
begPosASL: PositionASL - virtual line start
endPosASL: PositionASL - virtual line end
ignoreObj1 (Optional): Object - first object to ignore or objNull: Default: objNull
ignoreObj2 (Optional): Object - second object to ignore or objNull: Default: objNull
sortMode (Optional): Boolean - true: closest to furthest, false: furthest to closest. Default: true
maxResults (Optional): Number - Max results to return. -1 to return every result. Default: 1
Return Value:
Array of intersections in format [[intersectPosASL, surfaceNormal, intersectObj, parentObject],...] where:
  • intersectPosASL - the actual position where line intersects 1st surface
  • surfaceNormal - a normal to the intersected surface
  • intersectObject - the object the surface belongs to (could be proxy object)
  • parentObject - the object proxy object belongs to (not always the same as intersect object)


Example 1:
_intersections = lineIntersectsSurfaces [eyePos player, aimPos chopper, player, chopper, true, -1];
Example 2:
arrow = "Sign_Arrow_F" createVehicle [0,0,0]; onEachFrame { _ins = lineIntersectsSurfaces [ AGLToASL positionCameraToWorld [0,0,0], AGLToASL positionCameraToWorld [0,0,1000], player ]; if (count _ins == 0) exitWith {arrow setPosASL [0,0,0]}; arrow setPosASL (_ins select 0 select 0); arrow setVectorUp (_ins select 0 select 1); hintSilent str _ins; };

Additional Information

See also:


Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

[[Category:Introduced with arma3dev version 1.49]][[ Category: arma3dev: New Scripting Commands | LINEINTERSECTSSURFACES]][[ Category: arma3dev: Scripting Commands | LINEINTERSECTSSURFACES]]


Bottom Section