GetModelDimensions

From GT-MP
Jump to: navigation, search
GetModelDimensions
Client-Side Function
System-users.png Client-Side Javascript.png JavaScript

Returns the bounds of a model, consisting of a "minimum" and "maximum" vector3. The minimum and maximum are essentially 2 opposite corners of a model, defining a bounding box, as demonstrated in this image:

ModelDimensions.png

Syntax

In Javascript
Client-Side Function

API.getModelDimensions(int model);
API.getModelDimensions(uint model);

Required Arguments

  • model: parameter input should be in int or uint type.


NOTE: This function returns data in ModelDimensions type.

Usage example(s)

In Javascript
Client-Side Function

function vectorToString(vector) {
    return `X: ${vector.X} Y: ${vector.Y} Z: ${vector.Z}`;
}

API.onResourceStart.connect(function() {
    var stt_prop_ramp_spiral_l_xxl = -274578370;
    var modelDimensions = API.getModelDimensions(stt_prop_ramp_spiral_l_xxl);

    API.sendChatMessage("Min: " + vectorToString(modelDimensions.Minimum));
    API.sendChatMessage("Max: " + vectorToString(modelDimensions.Maximum));
});

References