A Bevy Engine plugin for making 2D paths, smooth animations, meshes and roads with Bezier curves.
Clone the repo, copy and paste the crate called "bevy_pen_tool_plugin" from the "crates" folder in the repo to the directory for your project, and add "bevy_pen_tool_plugin" as a local dependency in Cargo.toml. Refer to main.rs and Cargo.toml for futher details.
A typical sequence of actions using the plugin would be as follows:
- Spawn curves
- Latch them together
- Group the latched curves (cannot be ungrouped)
- Move anchors and control points to desired position
- Compute the look-up table
- Save
A user can save and load the data structure for a group of Bezier curves -- called Group in the code -- in JSON format. The default directory for saving groups is "./saved/groups/", and the file extension is a custom one: ".group". Meshes can be saved in well-known ".obj" format, and their default save directory is "./saved/meshes". The one save button prompts a file dialog window for each data structure that can be saved in the current session.
There are two important parameters to tweak and they are both located in a Resource called "Globals"
- group_lut_num_points: the number of elements in the generated look-up table (more yields smoother animations/meshes)
- road_width: the width of the road meshes. Refer to main.rs to see how to modify these parameters.
When the control points, shown as arrow tips, are hidden, the plugin places them almost exactly on top of the anchors. In this mode of operation, one can draw an arbitrary polygon and generate the corresponding mesh.
bevy_pen_tool, in its current form,
- attemps to follow Bevy's latest release
- does not work with a Perspective Camera (only Orthographic)
- cannot save multiple groups at once, only a single one
- deletes everything on the canvas before loading a group of Bezier curves
- ability to move whole group
- select and delete mesh
- saving multiple groups
- ruler tool
- no guarantees, but maybe a 3D version