Skip to content

mournguard/godot-multimesh-scatter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MultiMesh Scatter

A simple tool to randomly place meshes.


ko-fi


Note: This plugin was created for Godot v4. If you are using Godot 3.5 (or older), you can find the corresponding plugin in the 3.5 branch.


random_rotation

video_01.mp4
video_02.mp4
video_03.mp4

Features

  • Scatter objects in the scene using a MultiMeshInstance node.
  • Adjust the instance count, size, and collision layer.
  • Randomize size and rotation of each instance.
  • Automatically rotates each instance to the normal of the terrain.
  • Advanced constraint options to scatter according to:
    • Vertex color
    • Terrain Angle

How to use

  1. Download this repository or download the addon from the AsseLib in Godot.
  2. Import the addons folder into your project.
  3. Activate MultiMesh Scatter under Project > Project Settings > Plugins.
  4. Add a MultiMeshScatter node to the scene.

Parameters

Scattering

  • count: The number of instances to generate.
  • scatter_type: Defines the scatter type. (Box / Sphere)
  • scatter_size: The size of the bounding box. Enable show_debug_area to view the size of the bounding box. Note: If the scatter_type is set to Sphere, only the x value will be used to specify the radius of the sphere.
  • collision_mask: The physics collision mask that the instances should collide with.
  • mesh_instance: A helper parameter, set a MeshInstance3D here and it's mesh will be used for scattering (avoids having to copy/paste)

Placement

  • offset_position: Add an offset to the placed instances.
  • offset_rotation: Add a rotation offset to the placed instances.
  • base_scale: Change the base scale of the instanced meshes.
  • min_random_size: The minimum random size for each instance.
  • max_random_size: The maximum random size for each instance.
  • random_rotation: Rotate each instance by a random amount between. -random_rotation and +random_rotation.

Advanced

  • use_angle: If enabled the scattering will only happen where the collision angle is above the specified threshold. (See Below)
  • angle: The maximum angle allowed for object to be added. Lower this to prevent scattering on more vertical surfaces.
  • use_vertex_colors: If enabled the scattering will only happen where vertex color of the surface below the specified threshold. (See Below)
  • r_channel: Scatter threshold for the red channel.
  • g_channel: Scatter threshold for the green channel.
  • b_channel: Scatter threshold for the blue channel.
  • randomize_seed: Enabling this will randomize the seed then turn this off again (kind of a button in the editor)
  • seed: A seed to feed for the random number generator.
  • show_debug_area: Toggle the visibility of the bounding box area.

Notes

  • The sphere placement type takes placement_size.x for the radius. The y and z values are not used.
  • The sphere placement type behaves more like a capsule shape. This means that only the horizontal radius is taken into account when scattering meshes.
  • Scattering occurs automatically in the editor whenever you change a parameter or move the MultiMeshScatter node. In game mode, the scatter occurs once at the beginning of the game.

Links

License

MIT License

About

A simple tool to randomly place meshes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • GDScript 100.0%