Skip to content

Commit

Permalink
CBA_fnc_getVolume not calculating volume correctly (#984)
Browse files Browse the repository at this point in the history
* CBA_fnc_getVolume not calculating volume correctly. Optional parameter added to specify greater precision.

* Removed optional parameter

* scripting style in header
  • Loading branch information
Wakbub authored and commy2 committed Sep 17, 2018
1 parent 4dc1986 commit f525479
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions addons/common/fnc_getVolume.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
Function: CBA_fnc_getVolume
Description:
Return the volume of an object based on the object's model's bounding box.
Return the volume of the bounding box of an object's model.
The bounding box is retrieved using boundingBoxReal instead of boundingBox for more precise measurements.
Parameters:
_object - an object to calculate the volume of <OBJECT>
_object - Object to calculate the volume of <OBJECT>
Returns:
_volume - the volume <NUMBER>
_volume - Volume of the bounding box <NUMBER>
Examples:
(begin example)
_volume = _vehicle call CBA_fnc_getVolume
private _volume = _vehicle call CBA_fnc_getVolume
(end)
Author:
Rommel
Anton
---------------------------------------------------------------------------- */
SCRIPT(getVolume);

params [["_object", objNull, [objNull]]];

private _bounds = (boundingBox _object) select 1;

(_bounds select 0) * (_bounds select 1) * (_bounds select 2)
(boundingBoxReal _object) params ["_leftBackBottom", "_rightFrontTop"];
(_rightFrontTop vectorDiff _leftBackBottom) params ["_width", "_length", "_height"];
_width * _length * _height

0 comments on commit f525479

Please sign in to comment.