Object Generator

In this lesson, we are going through two ways of placing props on your map efficiently. This Object Generator is useful when you want to place lots of assets in your scene without using a Terrain or when you need foliage at a specific place. It is also useful if you want the player to interact with those objects as they are all Core Objects. For example, you can spawn templates with scripts.

Placing objects with your cursor (X)

To place objects in your scene, you can select an object in the Core Content or Project Content and press the key X while moving your cursor in your scene. A new instance of this object is placed at the position your cursor is pointing at.

Press X to spawn objects

For more control on the object that is spawned, you can open the Window > Object Generator and tune the parameters. Press Shift + X to apply those parameters. You can randomize the scale, the yaw (which is the rotation on the Z-axis), and even the color of the Base Material (red, green and blue values between 0 and 1). You can also use Spawn Upright or Only Spawn On Terrain for specific use-cases like trees.

Press Shift+X to spawn trees upright

Placing objects under another asset

Core comes with a tool that allows you to place lots of objects in a zone with random parameters.

Bottom of the Object Generator window

To use this button, place any asset on your map (triggers or any cubes are recommended). After scaling this asset above the zone you want to cover, select it in your Hierarchy and select an asset in your Content. Everything is now set up, you can then press the Spawn Selected Asset Under Selected Hierarchy Object button. You can also use Spawn Upright or Only Spawn On Terrain for specific use-cases.

Before pressing the button, select the object in the Content
and the Trigger in the Hierarchy
After pressing the button, a new group is created in the Hierarchy
with the spawned objects inside

The 4 parameters under the button give you more control over the spawned assets:

  • In-Between Distance is the medium distance between objects.
  • Position Randomness is a random offset. If set to 0, all objects are aligned on a grid where one cell is the size of In-Between Distance. If set to 1, the offset position can go up to the In-Between Distance.
  • Max Allowable Slope is an angle from which objects won’t spawn. If set to 60, then the items can spawn on objects or terrain with a slope lower than 60 degrees.
  • Put Objects In Group create a new group in the Hierarchy containing all the generated objects.
In this example, the flowers are spawned with a Position Randomness to 0, they are aligned on a grid of size In-Between Distance.

Try it in Core! Add the last objects in your scene using the object generator or the X shortcut.
Custom the sky and the post-process effects to change the atmosphere of your game.

Post a comment

Leave a Comment

Scroll to Top