Difference between revisions of "lineIntersectsSurfaces"
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (example updated) |
Killzone Kid (talk | contribs) (extended with optional LODs) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
− | | 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.|= 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.<br><br> |
+ | Since Arma v1.51.131920 it is possible to indicate primary and secondary LOD to look for intersection. Available options are: | ||
+ | * "FIRE" | ||
+ | * "VIEW" | ||
+ | * "GEOM" | ||
+ | * "IFIRE" - ("I" stands for Indirect, almost the same as FIRE) | ||
+ | * "NONE" | ||
+ | |||
+ | Default LODs are "VIEW" and "FIRE" |= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
− | | '''lineIntersectsSurfaces''' [begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults] |= Syntax | + | | '''lineIntersectsSurfaces''' [begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults, LOD1, LOD2] |= Syntax |
− | |p1= [begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults]: [[Array]]|= Parameter 0 | + | |p1= [begPosASL, endPosASL, ignoreObj1, ignoreObj2, sortMode, maxResults, LOD1, LOD2]: [[Array]]|= Parameter 0 |
|p2= begPosASL: [[PositionASL]] - virtual line start |= Parameter 1 | |p2= begPosASL: [[PositionASL]] - virtual line start |= Parameter 1 | ||
|p3= endPosASL: [[PositionASL]] - virtual line end |= Parameter 2 | |p3= endPosASL: [[PositionASL]] - virtual line end |= Parameter 2 | ||
Line 18: | Line 26: | ||
|p6= sortMode (Optional): [[Boolean]] - [[true]]: closest to furthest, [[false]]: furthest to closest. Default: [[true]] |= Parameter 5 | |p6= sortMode (Optional): [[Boolean]] - [[true]]: closest to furthest, [[false]]: furthest to closest. Default: [[true]] |= Parameter 5 | ||
|p7= maxResults (Optional): [[Number]] - Max results to return. -1 to return every result. Default: 1|= Parameter 6 | |p7= maxResults (Optional): [[Number]] - Max results to return. -1 to return every result. Default: 1|= Parameter 6 | ||
+ | |p6= LOD1 (Optional): [[String]] (added in v1.51.131920) - Primary LOD to look for intersection. Default: "VIEW" |= Parameter 5 | ||
+ | |p7= LOD2 (Optional): [[String]] (added in v1.51.131920) - Seondary LOD to look for intersection. Default: "FIRE" |= Parameter 6 | ||
| [[Array]] of intersections in format <nowiki>[</nowiki>[intersectPosASL, surfaceNormal, intersectObj, parentObject],...] where: | | [[Array]] of intersections in format <nowiki>[</nowiki>[intersectPosASL, surfaceNormal, intersectObj, parentObject],...] where: | ||
Line 33: | Line 43: | ||
[[AGLToASL]] [[positionCameraToWorld]] [0,0,1000], | [[AGLToASL]] [[positionCameraToWorld]] [0,0,1000], | ||
[[player]] | [[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; | ||
+ | };</code> |= Example 2 | ||
+ | |||
+ | |x3= This should detect glass windows and wire fences (since Arma v1.51.131920): <code>wirefence = "Land_New_WiredFence_5m_F" createVehicle position player; | ||
+ | arrow = "Sign_Arrow_F" [[createVehicle]] [0,0,0]; | ||
+ | [[onEachFrame]] { | ||
+ | _ins = [[lineIntersectsSurfaces]] [ | ||
+ | [[AGLToASL]] [[positionCameraToWorld]] [0,0,0], | ||
+ | [[AGLToASL]] [[positionCameraToWorld]] [0,0,1000], | ||
+ | [[player]], | ||
+ | [[objNull]], | ||
+ | [[true]], | ||
+ | 1, | ||
+ | "GEOM", | ||
+ | "NONE" | ||
]; | ]; | ||
[[if]] ([[count]] _ins == 0) [[exitWith]] {arrow [[setPosASL]] [0,0,0]}; | [[if]] ([[count]] _ins == 0) [[exitWith]] {arrow [[setPosASL]] [0,0,0]}; |