selectionPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "| arma |" to "| arma1 |")
(Add selectionVectorDirAndUp to see also)
 
(55 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma1 |Game name=
|game1= arma1
|version1= 1.00


|1.00|Game version=
|game2= arma2
|version2= 1.00


|arg= global|Multiplayer Arguments=
|game3= arma2oa
|version3= 1.50


|gr1= Object Manipulation |GROUP1=
|game4= tkoh
|version4= 1.00


|gr2= Render Time Scope |GROUP2=
|game5= arma3
____________________________________________________________________________________________
|version5= 0.50


| Search for selection in the object model (first in the memory level, then in geometry LODs).<br>
|arg= global
Returns position in model space. In {{Name|arma1|short}} it returns the initial position of the selection, in {{arma2}}/{{arma3}} position of the selection (e.g. when it is animated) in render time scope. If a selection does not exist [0,0,0] is returned. |DESCRIPTION=
____________________________________________________________________________________________


| object '''selectionPosition''' selectionName |SYNTAX=
|gr1= Object Manipulation


|p1= object: [[Object]] |PARAMETER1=
|gr2= Render Time Scope


|p2= selectionName: [[String]] |PARAMETER2=
|descr= Returns selection position in model space pertaining to the current animation in [[Simulation vs Render Time Scope|render time scope]].
When the default syntax is used, command searches first in Memory [[LOD]], then in Geometry LOD, FireGeometry LOD, LandContact LOD, HitPoints LOD and finally in ViewGeometry LOD and returns the first matching find.
The second syntax allows to specify which one of these LODs to search in instead.
{{Feature|important|
Sometimes internally "ViewGeometry" could be equal to "Geometry", and "FireGeometry" could be equal to "ViewGeometry".
In order to pinpoint the actual LOD, use [[allLODs]] and [[LOD_resolutions|LOD resolution]] as argument for selecting the LOD.
}}
 
|s1= object [[selectionPosition]] selectionName
 
|p1= object: [[Object]]
 
|p2= selectionName: [[String]]
 
|r1= [[Array]] - [[Position#PositionRelative|relative position]] in model space. If selection does not exist, [0, 0, 0] is returned.
 
|s2= object [[selectionPosition]] [selectionName, LOD, returnMode]
 
|s2since= arma3 1.50
 
|p21= object: [[Object]]
 
|p22= selectionName: [[String]]
 
|p23= LOD: [[String]] or [[Number]] - can be one of:
* {{hl|"Memory"}}
* {{hl|"Geometry"}}
* {{hl|"FireGeometry"}}
* {{hl|"LandContact"}}
* {{hl|"HitPoints"}}
* {{GVI|arma3|2.06|size= 0.75}} {{hl|"ViewGeometry"}}
When [[Number]] is used, command searches for a LOD with the similar [[LOD resolutions|LOD resolution]]
|p23since= arma3 2.06
 
|p24= returnMode: [[String]] - (Optional, default {{hl|"FirstPoint"}}) can be one of:
* {{hl|"FirstPoint"}}
* {{hl|"AveragePoint"}}
* {{hl|"BoundingBox"}}
 
|p24since= arma3 2.08
 
|r2= [[Array]] - [[Position#PositionRelative|relative position]] in model space. If selection does not exist, [0, 0, 0] is returned. If returnMode is {{hl|"BoundingBox"}}, [[Array]] of [[Array]]s


| [[Array]] - in format [[PositionRelative]] ([x,y,z] relative position in model space) |RETURNVALUE=
|s3= [[selectionPosition]] [object, selectionName, LODIndex, isVisual, returnMode]


|s2= object '''selectionPosition''' [selectionName, LODName] {{since|arma3|1.49.131660|y}} |SYNTAX2=
|s3since= arma3 2.06


|p21= object: [[Object]] |PARAMETER21=
|p41= object: [[Object]]


|p22= [selectionName, LODName]: [[Array]] |PARAMETER22=
|p42= selectionName: [[String]]


|p23= selectionName: [[String]] |PARAMETER23=
|p43= LODIndex: [[Number]] - the index of the target LOD (see [[allLODs]])


|p24= LODName: [[String]] - LOD name, one of the following:
|p44= isVisual: [[Boolean]] - (Optional, default [[true]]) [[true]] for Render, [[false]] for Simulation [[Simulation_vs_Render_Time_Scope|time scope]]
* "Memory"
* "Geometry"
* "FireGeometry"
* "LandContact"
* "HitPoints" |PARAMETER24=


|r2= [[Array]] - [x,y,z] relative position in model space |RETURNVALUE2=
|p45= returnMode: [[String]] - (Optional, default {{hl|"FirstPoint"}}) can be one of:
____________________________________________________________________________________________
* {{hl|"FirstPoint"}}
* {{hl|"AveragePoint"}}
* {{hl|"BoundingBox"}}


|x1= <code>_inModelPosition = [[player]] [[selectionPosition]] "head_hit";</code> |EXAMPLE1=
|p45since= arma3 2.08


|x2= <code>_inModelPosition = [[player]] [[selectionPosition]] "pelvis";</code> |EXAMPLE2=
|r3= [[Array]] - [[Position#PositionRelative|relative position]] in model space. If selection does not exist, [0, 0, 0] is returned. If returnMode is {{hl|"BoundingBox"}}, [[Array]] of [[Array]]s


|x3= <code>_inModelPosition = [[player]] [[selectionPosition]] "head";</code> |EXAMPLE3=
|x1= <sqf>_inModelPosition = player selectionPosition "head_hit";</sqf>


|x4= <code>_inModelPosition = [[player]] [[selectionPosition]] "camera";</code> |EXAMPLE4=
|x2= <sqf>_inModelPosition = player selectionPosition "pelvis";</sqf>
____________________________________________________________________________________________


| [[modelToWorld]], [[selectionNames]] |SEEALSO=
|x3= <sqf>_inModelPosition = player selectionPosition "head";</sqf>
}}


<h3 style="display:none">Notes</h3>
|x4= <sqf>_inModelPosition = player selectionPosition "camera";</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on January 5, 2007 - 12:24
<dt class="note">[[User:Giova|Giova]]<dd class="note">
To know more selections simply create an eventHandler damage on an object.
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x5= <sqf>
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
stomper selectionPosition ["wheel_1_1", "HitPoints", "FirstPoint"]; // [-0.774058,0.860854,-1.40365]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
stomper selectionPosition ["wheel_1_1", "HitPoints", "AveragePoint"]; // [-0.597142,1.35486,-1.58345]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
stomper selectionPosition ["wheel_1_1", "HitPoints", "BoundingBox"]; // [[-0.774058,0.860854,-2.07746],[-0.420225,1.84887,-1.08944]]
</sqf>


<!-- CONTINUE Notes -->
|seealso= [[selectionVectorDirAndUp]] [[modelToWorld]] [[selectionNames]] [[getAllHitPointsDamage]] [[allLODs]] [[LOD resolutions]]
<dl class="command_description">
}}
<dd class="notedate">Posted on July 29, 2015 - 09:35 (UTC)</dd>
<dt class="note">[[User:Jezuro|Jezuro]]</dt>
<dd class="note">
Since 1.49.131660, you can use an alternative syntax:
<br><br>
object '''selectionPosition''' [selectionName, lodName]
<br><br>
lodName: "Memory", "Geometry", "FireGeometry", "LandContact", "HitPoints"
<br><br>
If the given selectionName is not found in the given lod, [0,0,0] is returned.
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Killzone_Kid
<dd class="notedate">Posted on June 25, 2017 - 15:13 (UTC)</dd>
|timestamp= 20170625151300
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|text= Do use the filter that comes with {{Link|#Syntax 2}} to suit your needs. For example [[player]] has 3 selections called "head" and their [[selectionPosition]]s are quite different from each other:
<dd class="note">Do use the filter that comes with Alt Syntax to suit your needs. For example [[player]] has 3 selections called "head" and their [[selectionPosition]]s are quite different from each other:
<sqf>
<code>[[player]] [[selectionPosition]] ["head", "Memory"]; // [0.173798,0.330415,1.37783]
player selectionPosition ["head", "Memory"]; // [0.173798,0.330415,1.37783]
[[player]] [[selectionPosition]] ["head", "FireGeometry"]; // [0.14375,0.206039,1.44689]
player selectionPosition ["head", "FireGeometry"]; // [0.14375,0.206039,1.44689]
[[player]] [[selectionPosition]] ["head", "HitPoints"]; // [0.144257,0.306769,1.53471]</code></dd>
player selectionPosition ["head", "HitPoints"]; // [0.144257,0.306769,1.53471]
</dl>
</sqf>
<!-- DISCONTINUE Notes -->
}}

Latest revision as of 20:46, 16 August 2023

Hover & click on the images for description

Description

Description:
Returns selection position in model space pertaining to the current animation in render time scope. When the default syntax is used, command searches first in Memory LOD, then in Geometry LOD, FireGeometry LOD, LandContact LOD, HitPoints LOD and finally in ViewGeometry LOD and returns the first matching find. The second syntax allows to specify which one of these LODs to search in instead.
Sometimes internally "ViewGeometry" could be equal to "Geometry", and "FireGeometry" could be equal to "ViewGeometry". In order to pinpoint the actual LOD, use allLODs and LOD resolution as argument for selecting the LOD.
Groups:
Object ManipulationRender Time Scope

Syntax 1

Syntax:
object selectionPosition selectionName
Parameters:
object: Object
selectionName: String
Return Value:
Array - relative position in model space. If selection does not exist, [0, 0, 0] is returned.

Syntax 2

Syntax:
object selectionPosition [selectionName, LOD, returnMode]
Parameters:
object: Object
selectionName: String
since Arma 3 logo black.png2.06
LOD: String or Number - can be one of:
  • "Memory"
  • "Geometry"
  • "FireGeometry"
  • "LandContact"
  • "HitPoints"
  • Arma 3 logo black.png2.06 "ViewGeometry"
When Number is used, command searches for a LOD with the similar LOD resolution
since Arma 3 logo black.png2.08
returnMode: String - (Optional, default "FirstPoint") can be one of:
  • "FirstPoint"
  • "AveragePoint"
  • "BoundingBox"
Return Value:
Array - relative position in model space. If selection does not exist, [0, 0, 0] is returned. If returnMode is "BoundingBox", Array of Arrays

Syntax 3

Syntax:
selectionPosition [object, selectionName, LODIndex, isVisual, returnMode]
Parameters:
object: Object
selectionName: String
LODIndex: Number - the index of the target LOD (see allLODs)
isVisual: Boolean - (Optional, default true) true for Render, false for Simulation time scope
since Arma 3 logo black.png2.08
returnMode: String - (Optional, default "FirstPoint") can be one of:
  • "FirstPoint"
  • "AveragePoint"
  • "BoundingBox"
Return Value:
Array - relative position in model space. If selection does not exist, [0, 0, 0] is returned. If returnMode is "BoundingBox", Array of Arrays

Examples

Example 1:
_inModelPosition = player selectionPosition "head_hit";
Example 2:
_inModelPosition = player selectionPosition "pelvis";
Example 3:
_inModelPosition = player selectionPosition "head";
Example 4:
_inModelPosition = player selectionPosition "camera";
Example 5:
stomper selectionPosition ["wheel_1_1", "HitPoints", "FirstPoint"]; // [-0.774058,0.860854,-1.40365] stomper selectionPosition ["wheel_1_1", "HitPoints", "AveragePoint"]; // [-0.597142,1.35486,-1.58345] stomper selectionPosition ["wheel_1_1", "HitPoints", "BoundingBox"]; // [[-0.774058,0.860854,-2.07746],[-0.420225,1.84887,-1.08944]]

Additional Information

See also:
selectionVectorDirAndUp modelToWorld selectionNames getAllHitPointsDamage allLODs LOD resolutions

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
Killzone_Kid - c
Posted on Jun 25, 2017 - 15:13 (UTC)
Do use the filter that comes with Syntax 2 to suit your needs. For example player has 3 selections called "head" and their selectionPositions are quite different from each other:
player selectionPosition ["head", "Memory"]; // [0.173798,0.330415,1.37783] player selectionPosition ["head", "FireGeometry"]; // [0.14375,0.206039,1.44689] player selectionPosition ["head", "HitPoints"]; // [0.144257,0.306769,1.53471]