intersect: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| arma1 |Game name=
| arma1
|1.00|Game version=
|1.00
|arg= global|Multiplayer Arguments=
|arg= global


|gr1= Math - Geometry |GROUP1=
|gr1= Math - Geometry


| Finds named selections in object which are in specified LOD, intersected by given section of a line. Return value is in the form of [selection, distance]. Multiple returned arrays are nested within a single array. No intersection returns []. ''lodName'' could be one of the following:  
| Finds named selections in object which are in specified LOD, intersected by given section of a line. Return value is in the form of [selection, distance]. Multiple returned arrays are nested within a single array. No intersection returns []. ''lodName'' could be one of the following:  
Line 12: Line 12:
* "GEOM"
* "GEOM"
* "IFIRE" - ("I" stands for Indirect, almost the same as FIRE)
* "IFIRE" - ("I" stands for Indirect, almost the same as FIRE)
* "PHYSX" - PhysX geometry LOD (since Arma 3 v2.01.146666)|DESCRIPTION=
* "PHYSX" - PhysX geometry LOD (since Arma 3 v2.01.146666)


| [object, lodName] '''intersect''' [begPos, endPos] |SYNTAX=
| [object, lodName] '''intersect''' [begPos, endPos]


|p1= [object, lodName]: [[Array]] |PARAMETER1=
|p1= [object, lodName]: [[Array]]
|p2= object: [[Object]] |PARAMETER2=
|p2= object: [[Object]]
|p3= lodName: [[String]] |PARAMETER3=
|p3= lodName: [[String]]
|p4= [begPos, endPos] : [[Array]] |PARAMETER4=
|p4= [begPos, endPos] : [[Array]]
|p5= begPos: [[Array]] - format [[PositionAGL]] |PARAMETER5=
|p5= begPos: [[Array]] - format [[PositionAGL]]
|p6= endPos: [[Array]] - format [[PositionAGL]] |PARAMETER6=
|p6= endPos: [[Array]] - format [[PositionAGL]]


| [[Array]] - array of intersections in format: [<nowiki/>[selection, distance],...], where
| [[Array]] - array of intersections in format: [<nowiki/>[selection, distance],...], where
* selection - name of intersected selection
* selection - name of intersected selection
* distance - distance from begPos
* distance - distance from begPos
The results are also sorted, closest selection first |RETURNVALUE=
The results are also sorted, closest selection first
   
   
|x1= <code>[_tank, "VIEW"] [[intersect]] [[1500, 1500, 2], [1550, 1500, 2]];</code> |EXAMPLE1=
|x1= <code>[_tank, "VIEW"] [[intersect]] [[1500, 1500, 2], [1550, 1500, 2]];</code>


|x2= <code>sphere = "Sign_Sphere10cm_F" [[createVehicle]] [0,0,0];
|x2= <code>sphere = "Sign_Sphere10cm_F" [[createVehicle]] [0,0,0];
Line 48: Line 48:
};</code> |EXAMPLE2=
};</code> |EXAMPLE2=


| [[lineIntersectsSurfaces]], [[terrainIntersect]], [[terrainIntersectASL]], [[terrainIntersectAtASL]], [[lineIntersects]], [[lineIntersectsWith]], [[lineIntersectsObjs]], [[cursorObject]], [[cursorTarget]], [[checkVisibility]] |SEEALSO=
| [[lineIntersectsSurfaces]], [[terrainIntersect]], [[terrainIntersectASL]], [[terrainIntersectAtASL]], [[lineIntersects]], [[lineIntersectsWith]], [[lineIntersectsObjs]], [[cursorObject]], [[cursorTarget]], [[checkVisibility]]


}}
}}

Revision as of 01:40, 18 January 2021

Hover & click on the images for description

Description

Description:
Finds named selections in object which are in specified LOD, intersected by given section of a line. Return value is in the form of [selection, distance]. Multiple returned arrays are nested within a single array. No intersection returns []. lodName could be one of the following:
  • "FIRE"
  • "VIEW"
  • "GEOM"
  • "IFIRE" - ("I" stands for Indirect, almost the same as FIRE)
  • "PHYSX" - PhysX geometry LOD (since Arma 3 v2.01.146666)
Groups:
Math - Geometry

Syntax

Syntax:
[object, lodName] intersect [begPos, endPos]
Parameters:
[object, lodName]: Array
object: Object
lodName: String
[begPos, endPos] : Array
begPos: Array - format PositionAGL
endPos: Array - format PositionAGL
Return Value:
Array - array of intersections in format: [[selection, distance],...], where
  • selection - name of intersected selection
  • distance - distance from begPos
The results are also sorted, closest selection first

Examples

Example 1:
[_tank, "VIEW"] intersect [[1500, 1500, 2], [1550, 1500, 2]];
Example 2:
sphere = "Sign_Sphere10cm_F" createVehicle [0,0,0]; onEachFrame { _begPos = positionCameraToWorld [0,0,0]; _begPosASL = AGLToASL _begPos; _endPos = positionCameraToWorld [0,0,1000]; _endPosASL = AGLToASL _endPos; _ins = lineIntersectsSurfaces [_begPosASL, _endPosASL, player, objNull, true, 1, "FIRE", "NONE"]; if (_ins isEqualTo []) exitWith {sphere setPosASL [0,0,0]}; _ins select 0 params ["_pos", "_norm", "_obj", "_parent"]; if !(getModelInfo _parent select 2) exitWith {sphere setPosASL [0,0,0]}; _ins2 = [_parent, "FIRE"] intersect [_begPos, _endPos]; if (_ins2 isEqualTo []) exitWith {sphere setPosASL [0,0,0]}; _ins2 select 0 params ["_name", "_dist"]; _posASL = _begPosASL vectorAdd ((_begPosASL vectorFromTo _endPosASL) vectorMultiply _dist); drawIcon3D ["", [1,1,1,1], ASLToAGL _posASL, 0, 0, 0, _name, 1, 0.03, "PuristaMedium"]; sphere setPosASL _posASL; };

Additional Information

See also:
lineIntersectsSurfacesterrainIntersectterrainIntersectASLterrainIntersectAtASLlineIntersectslineIntersectsWithlineIntersectsObjscursorObjectcursorTargetcheckVisibility

Notes

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

Notes

Posted on Jul 25, 2007 - 08:37
ManDay
The most common LOD is "FIRE", which identifies the most detailled hitbox used for ammunition.
Posted on Mar 27, 2014 - 14:52
ffur2007slx2_5
Example (In ArmA3 ver 1.14) display returned arrays on cursor entities:
Sto = []; Fn = { { Sto set [_foreachindex,[cursortarget,_x] intersect [(asltoagl (eyepos player)),(screentoworld [0.5,0.5])]]; } foreach ["FIRE","VIEW","GEOM","IFIRE"]; hintsilent format ["FIRE: %1, VIEW: %2, GEOM: %3, IFIRE: %4",Sto select 0,Sto select 1,Sto select 2,Sto select 3]; }; ["sample_id","onEachFrame","Fn"] call BIS_fnc_addStackedEventHandler; Return FIRE: [something], VIEW: [something], GEOM: [something], IFIRE: [something].

Bottom Section

Posted on August 20, 2015 - 18:34 (UTC)
Killzone Kid
intersect will spam .rpt if passed to it object has no skeleton. Use getModelInfo to filter out those objects.