Log in to reply
 

GET_MODEL_DIMENSIONS not working?



  • I have no idea why this returns Vector3(0, 0, 0)

    Vector3 getDimensions(Hash modelHash) {
    	Vector3 min;
    	Vector3 max;
    
    	GAMEPLAY::GET_MODEL_DIMENSIONS(modelHash, &min, &max);
    
    	Vector3 ret = Vector3();
    
    	ret.x = max.x - min.x;
    	ret.y = max.y - min.y;
    	ret.z = max.z - min.z;
    
    	return ret; // returns Vector3(0, 0, 0)
    }
    

    Shouldn't be Y = model longitude and Z = model height?
    Is there other way to get vehicle dimensions?


  • MODERATOR

    @Rbn3D What's your Vector3 struct and for which models have you used it?



  • @Unknown-Modder It's the one that comes with Script Hook V.

    I'm on mobile right now but it just has float x, y, z.
    I'm use it with vehicles (mostly cars), and always returns 0, 0, 0.


  • MODERATOR

    @Rbn3D Make sure the struct looks like this:

    float x;
    DWORD _paddingx;
    float y;
    DWORD _paddingy;
    float z;
    DWORD _paddingz;
    

    and change Vector3 ret = Vector3(); to Vector3 ret;



  • @Unknown-Modder

    I managed it to work. But these dimensions changes as the car rotates. It's some kind of bounding box.
    Is there any way to get vehicle height / longitude ? I'm developing a custom vehicle camera mod and needed these values.

    Thank you for your help!



  • @Rbn3D

    Friend, could you post the solution here because I have the same problem.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.