Returns the maximum Z coordinate of a mesh's bounding box in local mesh space.
Takes entity (mesh entity handle).
Returns maximum Z value, or 0.0 on error.
3D Graphics
Parameters & Returns
Parameters
entityInt
Returns
Double
Quick Summary
Returns the maximum Z coordinate of a mesh's bounding box in local mesh space.
Takes entity (mesh entity handle).
Returns maximum Z value, or 0.0 on error.
Technical Exegesis...
Returns the maximum Z coordinate of a mesh's bounding box in local mesh space. Takes entity (mesh entity handle). Returns maximum Z value (Double), or 0.0 on error. Validates entity exists and type is ENTITY_MESH. Validates mesh has vertex data (not empty). Iterates all vertices in mesh to find maximum Z position. Returns unscaled mesh-space coordinate (does not account for entity scale/rotation). Silently returns 0.0 on errors.
Returns the maximum Z coordinate of a mesh's bounding box in local mesh space. Takes entity (mesh entity handle). Returns maximum Z value (Double), or 0.0 on error. Validates entity exists and type is ENTITY_MESH. Validates mesh has vertex data (not empty). Iterates all vertices in mesh to find maximum Z position. Returns unscaled mesh-space coordinate (does not account for entity scale/rotation). Silently returns 0.0 on errors.
This function queries mesh bounding box extent for collision detection, depth culling, or procedural placement. Returns local-space coordinates before transforms applied - multiply by entity scale to get world-space extent. Useful for: (1) Calculating bounding boxes (get MinX/MaxX/MinY/MaxY/MinZ/MaxZ for full bounds), (2) Depth alignment (align back edge to position: entityZ = targetZ - b3dMeshMaxZ), (3) Procedural placement (stack objects depth-wise: nextZ = prevZ + b3dMeshMaxZ(prev)), (4) Collision volume sizing (depth = MaxZ - MinZ). Coordinate system: right-handed, Z-axis points forward/into screen. For scaled bounds, multiply by b3dEntityScaleZ (global scale). For rotated bounds, transformation required (not axis-aligned). Complements b3dMeshDepth (depth = MaxZ - MinZ), b3dMeshWidth, b3dMeshHeight. Use b3dFitMesh to scale mesh to fit target dimensions. Returns actual vertex position max - for primitives like sphere/cube, typically radius or size/2. For loaded meshes, depends on modeling coordinates. Common values: cube (1.0), sphere (1.0), custom meshes (arbitrary). Performance: O(n) iteration over vertices - cache result if querying repeatedly. Does not trigger GPU operations.
Example
Example.bam
; Create visual bounding box for a meshFunction CreateBoundingBox:Int(mesh:Int)
Local minX:Double = b3dMeshMinX(mesh)
Local maxX:Double = b3dMeshMaxX(mesh)
Local minY:Double = b3dMeshMinY(mesh)
Local maxY:Double = b3dMeshMaxY(mesh)
Local minZ:Double = b3dMeshMinZ(mesh)
Local maxZ:Double = b3dMeshMaxZ(mesh)
Local width:Double = (maxX - minX) * b3dEntityScaleX(mesh)
Local height:Double = (maxY - minY) * b3dEntityScaleY(mesh)
Local depth:Double = (maxZ - minZ) * b3dEntityScaleZ(mesh)
Local bbox:Int = b3dCreateCube(1, 0, 0)
b3dScaleEntity(bbox, width / 2.0, height / 2.0, depth / 2.0)
b3dPositionEntity(bbox, b3dEntityX(mesh), b3dEntityY(mesh), b3dEntityZ(mesh))
Return bbox
EndFunction