Skip to content

Godot engine addon to randomly fill an area with props or other scenes

License

Notifications You must be signed in to change notification settings

HungryProton/scatter

Repository files navigation

ProtonScatter

Banner

Place anything you want in your scenes, in a procedural, non-destructive way.

What is it?

This is an add-on for Godot 4, which automates the positioning of assets in a scene. If you have a lot of props to place, and you would rather not do it by hand, ProtonScatter may be useful to you.

scatter_project.mp4
scatter_showcase.mp4
Placing grass on arbitrary geometry Editing the showcase scene

The showcase scene composition was entirely done using ProtonScatter. First, large rocks are randomly placed within an area, then trees, grass and other details are projected onto the rocks' colliders surface.

How does it work?

The basic setup is as follows:

setup

  • A ProtonScatter (1) node holds the positionning rules (2) that can be edited in the inspector. This panel is very similar to Blender's modifier stack panel. Some modifiers create points, others change their transforms. You mix different modifiers in order to obtain the result you need.

  • One or more ScatterItem nodes to select which asset you want to place.

  • One or more ScatterShape items to define the area where the scattering happens.

Creating points

grid random along_edge
Placing items aligned on a grid Placing items randomly Placing items along an edge

Defining the domain

Scatter currently ships with three shape types: Box, Sphere and Path. They can be combined to create more complex shapes. Notice how in the last example, the box is shown in red. This means the shape is marked as 'negative' and new items won't appear inside.

box sphere path combined_shapes

Other uses

Most of the examples above placed items on the floor or on a flat plane, but nothing stops you from using the full 3D space. The mushrooms are placed in the space, then projected in a random direction until they hit a tree. The tower in the background is done by stacking individual bricks using two array modifiers.

scatter_v4_mushroom.mp4

FAQ

How to install this addon?

Using the asset lib

  • Using the asset lib, look for ProtonScatter and click on Install.
  • If nothing appears, that means the add-on was not accepted yet, so use the manual method.

Manually

  • Download or clone this repository.
  • Copy the proton_scatter folder into your project's add-on folder.
  • DO NOT rename the proton_scatter folder, or it won't work.
  • Go to your Projects settings > Plugins > and enable ProtonScatter.

Does it work on Godot 3.x ?

  • Go to the v3 branch and install it from there.
  • Keep in mind that ProtonScatter was completely rewritten and overhauled for Godot 4, there will be significant differences.
  • If you're upgrading your project from Godot 3 to Godot 4, the previous Scatter objects will NOT be compatible anymore.

Where's the documentation?

  • Click on any ProtonScatter node and look at the Modifier Stack in the inspector.
  • You will see a Doc button in the top right corner. Click it to access the built-in documentation.

image

License

  • This add-on is published under the MIT license.
  • About the game assets under the demo folder:
    • 3D assets are under the MIT license.
    • Most textures bundled with this project have been created with images from Textures.com. You cannot redistribute them on their own, but they're free to use as part of a bigger project. Please visit www.textures.com for more information.