Vindicta icon indicating copy to clipboard operation
Vindicta copied to clipboard

Being on a roof should be supicious.

Open billw2012 opened this issue 4 years ago • 2 comments

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.

billw2012 avatar May 21 '20 18:05 billw2012

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];
};

SomethingSimpl avatar May 24 '20 09:05 SomethingSimpl

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.

Sparker95 avatar May 24 '20 10:05 Sparker95