Jump to content

Recommended Posts

 

 Trying to accomplish 2 things:

1: Find distance to the nearestBuilding but I need it to be accurate to the model itself. Meaning, right now I run a distance check an it can go as high as 50m while im inside the building?! Its as if if there is some point in named building in the model and that is what is being measured against. Need to know if i can distance check against the model itself so that if im standing next to the building it will always be 2-3meters max -not 40-50.

 

2. So when I run a _nb = nearestBuilding Player it returns '1640b757580# 462130: house_small_05_f.p3d'. I had always remembered it returning just the 'house_small_05_f', not the rest. Reason being I need to run a if (_nb == house_small_05_f) then {blah blah blah} but no luck

Share this post


Link to post
Share on other sites

_nb = typeOf nearestBuilding Player ;

Keep on mind:

- this command doesn't return all buildings (No vanilla Atlis airport tower or radar dome or transformer or small factory.... for instance).

- this command doesn't work on any placed building via editor....

- this command can drastically slow down the script (if in a clear area like a runway) ~ 3ms!;

Try it. If it works.. well! If not:

use: typeOf (nearestObjects [player, ["House"], 50] select 0);

Now, you have some good feedback for houses, ... but also some useless things like all "Land_runway_edgelight"...

Nothing is perfect, but the building / house classes on Arma are absolutely weird!

 

You can also test nearestTerrainObjects instead of nearestObjects. See BIKI for all subtleties.

Share this post


Link to post
Share on other sites

to measure a better distance to such a house you can use boundingBoxReal. This gives u the lower left and the upper right points of the box around the object.

To get the distance to that box u only need some math ;-)

Share this post


Link to post
Share on other sites

boundingBoxReal will not get the sort of accuracy (2-3meters max)  that he is looking for. On some buildings maybe only one side will have that accuracy.

Share this post


Link to post
Share on other sites
3 hours ago, Jigsor said:

boundingBoxReal will not get the sort of accuracy (2-3meters max)  that he is looking for. On some buildings maybe only one side will have that accuracy.

what I miss in ur post is a suggestion for a better solution. Beside that the bounding box precision should be much better then a usual distance check where the middle of both objects is measured.

 

Maybe it could be better done with

lineIntersectsSurfaces

but that needs some sort of heavy scripting to work around various problems like having another object like a car in the line between the player and the house.

But well, it could be done. Its a question of priority. fast script and low precision (but much higher then with the middle of the house like a usual distance check does) or heavy scripting with a probably measurable impact on fps and a veriy precise distance value if it is well scripted...

  • Like 2

Share this post


Link to post
Share on other sites

 

 Id like to keep it cheap as possible because it may be checking many units at once quite a bit. What Im working in are voice cues from the AI when an enemy is spotted indoors and on what floor as well as the roof. I use lineIntersect for detecting ceilings so it works fine for the most part except when under a tree canopy near a house or obviously on the roof of very tall building. I guess I could just use a height check for enemy units and blacklist vehicles but id like to look for specific proximity to certain buildings just to be sure.

 

 Houselist =  ["land_house_small_05_f", "land_hotel_01_f"];   \\example House array

_nb = typeOf (nearestObjects [player, ["House"], 50] select 0);

hint str _nb;                                                                               \\returns "land_hotel_01_f"

if ( _nb in Houselist) then

      {systemChat "Same!"}                                                          \\ does not fire

 

Not sure why this doesnt fire even tho strings match..

 

 

Share this post


Link to post
Share on other sites

Are u sure that the strings match? It has to be case sensitive and if u want to have a check without that then use toLower command on the strings

sent from mobile using Tapatalk

  • Like 1

Share this post


Link to post
Share on other sites

 

 Derp. My mother was right about me - i am dumb!

 

 Thanks^

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

×