Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBA_fnc_getVolume not calculating volume correctly #984

Merged
merged 3 commits into from
Sep 17, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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