Object Painter
Tool Guide
Written by: Brandon L’Abbe
Project Nautilus
Project Nautilus
1. Purpose
The Object Painter Tool is a tool that will allow a developer to quickly place multiple instances of a prefab onto another object in the world that has a Collider attached to it. The tool has two options for placement: randomly distributed within a wire disc drawn on the mouse location in the world or single placement mode, which allows you to precisely place a single object at a time.
2. Method
Upon opening the tool, the tool will default to the first placement option: randomly distributing objects within a disc. With this option, the user will be able to hover over any object with a Collider in the scene, and they will see a green wire disc drawn on that point. Within the wire disc will be 8 point normals randomly chosen within the disc, as well as a red normal representing the center of the disc. The user will be able to connect a prefab that will generate on all of the yellow points once they select Enable Painting. The tool will also allow the developer to have the objects spawn with random rotations along the yellow normal axis shown in the world. The user will have the option to embed the objects into the surface they are placing on. Both of these could be beneficial to make spawned objects look more natural and less uniform. The user will be able to re-randomize the points within the disc, as well as have a single-object placement mode so they can place objects on an individual basis.
3. Tool Setup
To access the tool, you must drop down the “My Tools” menu from the list of drop downs at the top of the Unity Window. In that dropdown, select “Object Painter”. If you do not see either of these, then you may not have the Tool installed in your version of the repo! To confirm this, if you go to Assets/Scripts/Tools, you should see one script named “ObjectPainter.cs”. If you don’t see this, then you do not have the tool in your version of the repository. Once you open the tool, it will open a Unity tab that you can dock to any area of your editor.
4. Tool Settings & Usage
Attached below is a screenshot of what the entire tool window with all of it’s settings looks like:
Here I will explain every part of the tool window in the form of a bulleted list. Indented sections are hidden behind it’s parent section.
- Radius [Float]: Determines the size of the disc shown in the world. This disc is the area that random points will be generated within.
- Spawn Count [Integer]: Determines how many random points will be calculated within the disc. The objects will be generated on these points, and these points will be visualized as yellow normals in the world within the disc.
- Spawn Prefab [GameObject]: The prefab that will be placed onto each of the spawn points when the user clicks with “Enable Painting” enabled.
- Enable Painting [Checkbox]: Determines whether painting is enabled. When disabled, the user may select items in the scene and traverse the scene as normal even though the wire disc is drawn on the mouse location. When enabled, if the user clicks within the scene, the Spawn Prefab will be instantiated and placed on each random point within the scene. When enabled, the user can also use the scroll wheel to change the radius of the disc.
- Single Object Mode [Checkbox]: When enabled, the wire disc and random points are removed from the scene. Instead, a single point will be drawn at the mouse location. When painting, only one object will be created at this point. Use this option when you want to paint one object at a time.
- Use Random Rotations [Checkbox]: When enabled, all painted objects will be rotated around the point normals by a random angle. This will make many spawned objects look a little more natural as they will all face different directions.
- Should Embed [Checkbox]: When enabled, all spawned objects will be embedded into the mesh that they are placed on. They are embedded along the inverse of the point normals.
- Embed Amount [Float]: The amount that the spawned objects are embedded.
- Generate New Points [Button]: When pressed, new random points will be generated within the wire disc.
5. Images
Drawn wire disc with random points within:
Rocks painted:
Rocks painted with random rotations:
5. Final Notes/Improvements
This tool is in no means a final version. As a Tools programmer, my job is to improve our tools as much as it is to make new ones. So if you have any ideas of tweaks or addons to this tool that would improve your usage of it, please reach out! I’m happy to listen to any tool ideas or how I can make my current tools better! If you have any issues using the tool, please reach out and I can do my best to help!