newton.utils.compute_world_offsets#

newton.utils.compute_world_offsets(num_worlds, spacing, up_axis=None)[source]#

Compute positional offsets for multiple worlds arranged in a grid.

This function computes 3D offsets for arranging multiple worlds based on the provided spacing. The worlds are arranged in a regular grid pattern, with the layout automatically determined based on the non-zero dimensions in the spacing tuple.

Parameters:
  • num_worlds (int) – The number of worlds to arrange.

  • spacing (tuple[float, float, float]) – The spacing between worlds along each axis. Non-zero values indicate active dimensions for the grid layout.

  • up_axis (Any, optional) – The up axis to ensure worlds are not shifted below the ground plane. If provided, the offset correction along this axis will be zero.

Returns:

An array of shape (num_worlds, 3) containing the 3D offsets for each world.

Return type:

np.ndarray