Jump to content
arma_max

Identify position of soldier's head

Recommended Posts

Hi,

 

Is there a way to retrieve the information where the head's position of a unit is and maybe even how big that object is on the screen? I want to retrieve that information to be able to draw a box around the head.

 

Max

Share this post


Link to post
Share on other sites
6 hours ago, arma_max said:

Hi,

 

Is there a way to retrieve the information where the head's position of a unit is and maybe even how big that object is on the screen? I want to retrieve that information to be able to draw a box around the head.

 

Max

Try this https://community.bistudio.com/wiki/selectionPosition.Best regards!

Share this post


Link to post
Share on other sites

I believe that selectPosition suggested by Spritefight is what you really need. One thing to keep in mind is that you may (or may not) want to use it in conjuction with modelToWorld command (see the doc) in order to get the "global" coordinates (for the specific map) of the head.

 

A simple example would be something like

// Get the position of the head in the model's coordinates system
private _headInModel = player selectionPosition "head";

// Translate it to correspond to "global" coordinates
private _headInMap = player modelToWorld _headInModel;

Please keep in mind that you can exchange player for the unit whose head's coordinates you want to get.

 

One additional comment here is that, as Killzone Kid suggests in the comments of the selectionPosition docs, you should most probably use the alternative syntax to get the position that "you want". For example (again duplicating the Killzone Kid's comment), a model has three different "head" selections for "Memory", "FireGeometry" and "HitPoints", which have different (relative to model) coordinates. So, the code for the alternative syntax could look like (assuming you want the "Memory" coordinates)

// Get the position of the head in the model's coordinates system
private _headInModel = player selectionPosition["head", "Memory"];

// Translate it to correspond to "global" coordinates
private _headInMap = player modelToWorld _headInModel;

Finally, please note that you would have to use the same model (unit) as the first argument in both commands in order to get the correct "global" coordinates.

 

Please note that these snippets are NOT tested, so please test before assuming they work as intended.

 

Hope this helps. If it doesn't or you need further assistance please don't hesitate to ask :).

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×