Set up a spherical Terrain

A spherical terrain in orbis is made by using 6 individual terrains, which are then used to form a cubesphere. This article provides a start in getting a new terrain from blank. Note that there are also readily made prefabs available in the Orbis/Terrains/Basic/ folder available

GameObject configuration Component

Whether a prefab terrain or a terrain from blank is being used, Orbis requires a GameObject in the Scene with a ‘OrbisInterface’ Component. This component can be on any GameObject that is not being converted to an Entity. Also, there can only be one ‘OrbisInterface’ per scene, or it will run into issues. You can manually add the component to an existing GameObject, or just add the ‘TerrainConfiguration’ prefab into your scene, which contains the component with predefined values.

Setup using Prefabs

The easiert way to bring a spherical, planetary terrain into a new scene is to use one of the available prefabs. They are found in “Orbis/Orbis_Terrains/Prefabs/”. The ‘Planet’ is a planet based on the new custom editor. This makes it easy to set up a scattered, procedural or heightmap-based plant.

Setup from blank

Creating a new spherical terrain from scratch is a bit more complicated. It requires 6 Terrains to be configured and to be moved to the face centers of a cube that is roughly the size of the desired planet. This means that there needs to be one terrain at the top, the bottom and left/right and front/back of the cube. Each terrain needs to be rotated to face outward of the cube, similar to the face of a fictional cube itself.

You can inspect the available prefabs to get an idea of how the positions of each terrain side need to be set up.

Required Components

When all terrain entities are position to be at the center of each face of a cube, the required components for the terrain need to be added to allow the mesh generation system to pick them up. Each component is defined in further in the details page.

To use the conversion workflow, add the “OrbisBaker” component to each terrain part. Orbis also ships with a helper component to make working with planets easier. When multiple orbis terrain have a common parent (e.g. to combine the different parts of a planet), you can add the “OrbisSelectionHelper” component to it.

For convenience and organization, it is recommended to assign all 6 planet sides to a single parent, as that makes moving and rotation the planet much easier. The OrbisBakerSystem will unparent the planet parts during conversion.

Terrain Rotations

All 6 terrain sides of the planet to be rotated to be facing away from the planet center (the ‘up’normal needs to be facing from the center). When using procedurally generated terrain, the terrain rotation on it’s local Y axis can be set to any multiple of 90, since the heights are sampled in world space, so there are no alignment issues.

However, when using a heightmap based planet, it is important to have the correct rotations on each side’s local Y axis so that the heightmaps of each side line up. Depending on your heightmaps, you may need to experiment around to find working values, however they should always be right angles, so any multiple of 90 should work.

When using the heightmap layout as used in the demo and in this documentation, the following rotations are used (format angle X; Y; Z):

  • Up: 0; 0; 0
  • Front: -90; 0; 0
  • Left: -90; 0; 90
  • Back: -90; 0; 180
  • Right: -90; 0; -90
  • Down: -180; -180; 0

Gravity Center

To enable spherical gravity on the planet, a “gravity emitter” (using the GravityEmitterBaker) in the center of the planet is required. This is included in the prefabs, but when starting from blank this is required when spherical gravity of the planet is wanted. To do so, add an entity that is in the center of the planet, and add the components ‘GravityCenter’ and ‘FloatingOriginRepositionTag’ to the entity.