Lorenz94 6 Posted January 4, 2019 Hello guys, I'm having problems in finding a vehicle's height. I've done some research, and I found out that bounding boxes can be oversized, so what I imagined is a little function that takes the bounding box height and from there starts lower, searching for interceptions. The problem consist in no intersections at all, so can you please help me with the command "lineIntersectsSurfaces"? Here's the function! Thank you and have a great day :D Spoiler fnc_getVehSize = { params ["_veh"]; _dimensions = []; (boundingBoxReal _veh) params ["_arr1", "_arr2"]; _width = abs ((_arr2 select 0) - (_arr1 select 0)); _length = abs ((_arr2 select 1) - (_arr1 select 1)); _height = abs ((_arr2 select 2) - (_arr1 select 2)); systemChat format ["Bound Height: %1", _height]; for "_i" from -5 to +5 do { if (isNil {_veh getVariable "height_found"}) then { _modelHeight = _height + _i; _pos = [getPosWorld (vehicle player) select 0, (getPosWorld (vehicle player) select 1) -10, _modelHeight]; lineIntersectsSurfaces [getPosWorld _veh, getPosWorld _veh vectorAdd [0,50,0], player, objNull, true, 1, "GEOM", "NONE"] select 0 params ["","","","_parent"]; if (_parent isKindOf "Tank") then { _veh setVariable ["height_found", _modelHeight]; hintSilent format ["Parent: %1\nBound Height: %2\nModel Height: %3", _parent, _height, _modelHeight]; }; }; }; }; [(vehicle player)] call fnc_getVehSize; _EH = addMissionEventHandler ["EachFrame", { _pos = [getPosWorld (vehicle player) select 0, getPosWorld (vehicle player) select 1, ((vehicle player) getVariable "height_found")]; //-2 editor tank drawIcon3D ["a3\ui_f\data\Map\Markers\Military\marker_CA.paa", [1,0,0,1], _pos, 0.6, 0.6, 0, str (_pos select 2), 0, 0.025, "PuristaBold"]; } ]; Share this post Link to post Share on other sites
davidoss 552 Posted January 4, 2019 for "_i" from -5 to +5 do { this line may not work like you intended, check rpt errors. Start with launcher parameter -showScriptErrors Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 4, 2019 8 minutes ago, davidoss said: for "_i" from -5 to +5 do { this line may not work like you intended, check rpt errors. Start with launcher parameter -showScriptErrors I've not read the context, but that will create a loop that goes from -5 to + 5. The + symbol is not required but it won't break anything. Share this post Link to post Share on other sites
davidoss 552 Posted January 4, 2019 True, i just realise that 1 Share this post Link to post Share on other sites