Returns mesh bounding box width (X-axis extent). Takes entity (mesh entity handle). Returns width as double (maxX - minX), 0.0 if invalid/empty mesh. Validates entity exists and is mesh type, iterates all vertices to find min/max X coordinates, calculates width as difference. Measures mesh geometry (not world space size, ignores entity transform).
This function calculates mesh width from vertex data.
Returns mesh bounding box width (X-axis extent). Takes entity (mesh entity handle). Returns width as double (maxX - minX), 0.0 if invalid/empty mesh. Validates entity exists and is mesh type, iterates all vertices to find min/max X coordinates, calculates width as difference. Measures mesh geometry (not world space size, ignores entity transform).
This function calculates mesh width from vertex data. Bounding box calculation: iterates all vertices in mesh (across all surfaces), finds minimum and maximum X coordinates: minX = min(vertex.position.x for all vertices), maxX = max(vertex.position.x for all vertices), width = maxX - minX. Mesh local space: measures geometry in mesh local space (before entity transform applied), ignores entity position/rotation/scale (entity transform doesn't affect result), measures raw mesh dimensions. Use case: determine mesh size for scaling/fitting operations, calculate collision bounds, validate import dimensions, procedural mesh sizing. Empty mesh: returns 0.0 if no vertices (mesh->vertices.empty()). Invalid handle: returns 0.0 if entity doesn't exist or isn't mesh type (with error message to stderr). Width vs world size: b3dMeshWidth measures geometry dimensions, for world-space size multiply by entity scaleX: worldWidth = b3dMeshWidth(entity) * b3dGetEntityScaleX(entity). Zero width: returns 0.0 for flat meshes (all vertices have same X coordinate, degenerate geometry like lines/points on YZ plane). Performance: O(N) where N=total vertex count (iterates all vertices once), cached vertex data (no GPU readback), fast operation for typical meshes. Typical usage: size = b3dMeshWidth(entity) to measure mesh, or check dimensions after procedural generation, or calculate scale factors for b3dFitMesh. Related: b3dMeshHeight measures Y-axis extent (height), b3dMeshDepth measures Z-axis extent (depth), b3dGetMeshBoundsMin/Max return full bounding box corners, b3dFitMesh scales mesh to fit target dimensions.