newton.utils.create_box_mesh#

newton.utils.create_box_mesh(extents)[source]#

Create a rectangular box (cuboid) mesh.

Generates vertices and triangle indices for a box shape with 6 faces. Each face consists of 2 triangles with proper normals pointing outward.

Parameters:

extents (tuple[float, float, float]) – Half-extents of the box in each dimension (half_width, half_length, half_height). The full box dimensions will be twice these values.

Returns:

A tuple containing:
  • vertices (np.ndarray): Float32 array of shape (N, 8) where each vertex contains [x, y, z, nx, ny, nz, u, v] (position, normal, UV coords).

  • indices (np.ndarray): Uint32 array of triangle indices for rendering.

Return type:

tuple[np.ndarray, np.ndarray]