Jump to content

[SOLVED] Determine if buildingPos is indoors?

Recommended Posts

Is it possible to determine which building positions, generated by { _building buildingPos -1; }, is indoors and inside the building?


I have had to manually check in all houses I wanted and make an array, but I would like to have it more dynamic and universal than that, no mention that it takes time to go through the different building types.

Share this post

Link to post
Share on other sites

you could do a


to check if there is a roof above the position.

could look like this:

parameter 1: object of builing
parameter 2: height to check for a roof. default value is 10 meters

return value:  array of roofed builing positions

example call:
 _roofed_pos = [_house1, _maxheight] fnc_roofed_pos;

fnc_roofed_pos =
  _default_height = 10;
  params["_building", ["_height", _default_height]];
 ([_building] call BIS_fnc_buildingPositions select {lineIntersects [_x, (_x vectorAdd [0, 0, _height]) , objNull, objNull})


  • Like 1

Share this post

Link to post
Share on other sites
58 minutes ago, sarogahtyp said:



Thanks, that helped. I didn't know about lineIntersects before.

I tailored your functions to my own needs (It didn't work at first since lineIntersects specifically need ASL pos and buildingPos outputs AGL)

Came up with this:

_spawnPos = selectRandom ((_building buildingPos -1) select {lineIntersects [AGLToASL _x, (AGLToASL _x) vectorAdd [0,0,10]]});

That works with the building with the highest roof in Altis (the ghost hotel foyer, I think).


Though I ended up keeping my original manual solution, since there were a few buildings with positions that were indoors I didn't want to spawn in. However since that is solved we can keep it here for the archives, in case anyone else needs it.


Thanks again!

  • 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