Vindicta
Vindicta copied to clipboard
Being on a roof should be supicious.
Might not be able to tell the difference between a roof or an elevated floor though... Also all movement actions (e.g. enhanced movement, step over etc) should be suspicious.
Hi, some time ago I had a script snippet for exactly this in one of my missions. Worked pretty well using the boundingBoxReal - maybe it wont work so well for misconfigured buildings or sometimes when player goes prone it may be actually lower than the bbox but should generally work fine. It also doesnt detect floors at all, essentially only the upper outline of the building.
_obj = nearestObject [player, "HouseBase"];
_boundBox = 0 boundingBoxReal _obj;
_boolean = "";
_height = _obj modelToWorld (_boundBox select 1);
_height = _height select 2;
_playerHeight = eyePos player select 2;
_terrainheight = getTerrainHeightASL (position player);
if (_playerHeight - _terrainheight <= _height) then { _boolean = "no" } else { _boolean = "yes" };
hint format ["On roof, %1", _boolean];
};
Good solution. I have a check if player is in a house in our code already: https://github.com/Sparker95/Vindicta/blob/c6d364df84575aea054c55bead6b2600ae9f1bb6/Vindicta.Altis/AI/Garrison/SensorGarrisonTargets.sqf#L141-L154 I think with the bounding box check it can work well, we only need to case a ray upwards instead of casting it both ways.