Jump to content

Get vehicle size


LeroY

Recommended Posts

function getVehicleSize(vehicle)
	if vehicle and isElement(vehicle) and getElementType(vehicle) == 'vehicle' then
		local minX,minY,minZ,maxX,maxY,maxZ = getElementBoundingBox(vehicle)
		return maxX-minX,maxY-minY,maxZ-minZ
	end
end

This returns the length, width, and height of the vehicle. Since it is 3d, you have 3 things to worry about.

Edited by ShayF
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...