Asset is now live! A 50% launch discount will run until April 9th.
This thread may be used for support, report issues and suggest improvements
Hi, Iām testing Spline Mesher and so far its pretty good and it looks like it will work well for the road system Iām creating for my game. Its a minor issue but I did notice at one point the side mesh separated out from the road mesh. Not sure how that happened but I couldnāt see a way to realign them automatically. If there is a way they can be realigned please let me know. Thanks Alexi
does this work on unity 2021?
Can the Spline be changed at Runtime or only in Editor?
Would you mind sharing a screenshot or two? Iām not sure what you mean by āside meshā, that being a mesh offset to the left/right of the spline?
Not officially, itās not a version Iām developing or testing for. But Iāve imported it into a 2021 project and thereās no compile errors, and all the functionality seems to work as it should!
Splines arenāt officially supported in 2021, so you canāt install the package. Itās possible to do this manually in the Package Manager by choosing āAdd package by nameā under the ā+ā icon:
All the functionality sits in runtime code, so thatās certainly possible. If you were to programmatically alter a spline, one thatās also assigned to a (or more) Spline Mesher component, the mesh updates as well.
Is it suitable for ancient city walls? For example, the Great Wall of China
I donāt see why not, a mesh is a mesh. Though youād probably want to break it up into segments, rather than creating single a 21.000+ km spline
Hello, are there any videos going through setup and use for some basic use cases like the ones in the demo scene?
I love this!! Evaluating if weāll be able to move off of our current Spline solution onto this in Unity 2022. It has most of what I need (I LOVE the ability for it to intelligently cast down and mold itself to other collision!), with one exception: there are cases in our game where we need to know if our character is Overlapping a Spline.
Since you canāt just turn a mesh collider into a trigger without making it Convex, the way we accomplish this with our current tool is to use a variant of the mesher that actually spawns each individually deformed piece of the generated mesh as its own game object, with its own collider. Each of these, on its own, can be made a convex trigger collider, and they all report their collisions to their parent, which lets us know that the player is intersecting with the Spline.
Is there any way to accomplish this with the tool as it exists? If not, would an option to spawn each segment of the Spline as its own game object be possible? Iām pretty sure this is our only barrier to adoption
Good point! Everything in the demo scene is indeed outlining a particular use case or feature, but I realize now that isnāt obvious.
What Iāll do is add a piece of 3D text to each object with a short description to clarify.
Awesome, glad to hear it!
The ability to spawn a mesh in segments (individual Mesh Renderers) is something thatās on the wishlist. Itās particularly useful to divide up very large meshes (eg. a guard rail along a long road).
Though spawning actual objects along a spline can already be achieved using the āSpline Instantiateā component. Hereās an example of a cube prefab being repeated along the mesh:
You can access this component by importing the Samples from the Spline package
If this asset proved to be beneficial please do consider leaving a review, this in an invaluable way to support future development and helps make complementary updates possible!
Iāve continued work on integrating Spline Mesher - things have gone reasonably well, but Iāve run into some more QOL challenges or actual blockers:
- Iām encountering a rather frustrating issue with a Water Spline setup Iāve created where, once I turn it into a Prefab (so that I can make waterways throughout my levels), if I draw a spline and then run the game, then exit the game, and then ever touch the Spline again, the entire mesh vanishes and I get hit with constant
[Physics.PhysX] cleaning the mesh failed
0x000001b3f70f9193 (Mono JIT Code) sc.modeling.splines.runtime.SplineMesher:CreateCollider () (at D:/Development/Unity/ProjectName/Assets/SplineMesher/Runtime/SplineMesher.cs:234)
0x000001b3f70f4613 (Mono JIT Code) sc.modeling.splines.runtime.SplineMesher:Rebuild () (at D:/Development/Unity/ProjectName/Assets/SplineMesher/Runtime/SplineMesher.cs:188)
The entire thing permanently locks up and I become unable to do anything with it until I destroy it and place a new one. Performing identical steps with an un-prefabād version of the same object results in no issue, as far as I can tell, but Iād very much like to use Prefabs. Iāve been unable to lock down an exact repro for this (it always happens to the actual asset Iāve made, but attempts to start from scratch and to narrow down what precisely is causing the issue is not yielding results. Maybe itās something to do with the precise models Iām using? Iāve attached them.)
-
Because I use multiple SplineMeshers that all reference the same base Spline, the Scaling feature becomes borderline unusable - since scale data is on a per-SplineMesher basis, and multi-selecting each SplineMesher and trying to use the Scale tool doesnāt work the way youād expect, and there doesnāt seem to be a way to copy/paste scale data from SplineMesher to SplineMesher, you end up needing to manually do your best to make all of the different meshes line up with regards to Scale, which seems extremely difficult if not impossible. Certainly not a smooth workflow.
-
And, the previously aforementioned inability to spawn submeshes - while the Spline Instantiate method is working at a baseline (thank you for the suggestion!) it also renders the idea of using the SplineMesherās scale mesh functions moot, since you canāt scale the instances to match at various points along the spline.
Unfortunately Iām not yet at a point where Iām confident to integrate this tool - in spite of how nice it is to get started with. Any suggestions on the above?
Valuable insights!
The error youāre getting directs at the point where the collision-mesh is assigned to the Mesh Collider. Internally, it gets post-processed by the physics engine, but I take whatever it was receiving is invalid. Something happened that causes an invalid mesh to be created (nothing caught by existing safety checks). I can only reproduce the same error by manually setting all the scale data to (0,0,0), which causes a mesh to be created with all vertices bunched up on the same point, creating degenerate triangles. So I assume itās related to that. Your meshes certainly look in order!
On that note: Iāll be sure to implement a safety check in the Scale tool, to check for such invalid scale data, and reset them. Scale data is normally added automatically, to ensure that is exists for every spline. But I can imagine itās possible to unintentionally circumvent this.
A useful debugging option is to reset the scale data through the context menu:
About the scale, I can see how it may be difficult to work with if youāre looking to make compound geometry. Adding support for multi-selection editing to the tool is rather straightforward fortunately, yet definitely something that hadnāt occurred to me.
Thereās a simple auxiliary component that can be made to copy the scale data from one component to another. See this script.
For the box colliders, example components are often useful, but specific functionality does require specific code. The easiest way I think is a post-processing script can go over all the collider objects and scale them using the scale data. Hereās an example component that does this.
Splines are very extendible so I want to encourage people to create addons tailored to their specific needs. With use case reaching far and wide tools would blow in complexity trying to cater to them all. Iāve extended the documentation with a āScriptingā section, and linked a couple of example code snippets that hopefully prove useful.
Thank you for your feedback so far!
Thank you so much for your reply! Your guidance was extremely helpful.
I was able to add some code that forwards the scale of one SplineMesher to all the rest, and it did the job nicely!
Your tip about Reset Scale helped me pin down the issue with my one prefab. I think in the process of turning it into a Prefab, some bad ScaleData had made its way into the Components. Everything worked fine upon first placement but upon entering and exiting play mode, that bad ScaleData ultimately broke something. I seem to have been able to re-Prefab the object with properly cleared ScaleData, and the issue has gone away.
Next up is getting the collider scaling working and I should be good to go! Happy to have given 5 stars already.
Pleased to say that Spline Mesher is proving to be a coveted tool on peopleās belt! It shot straight up to the top 5 assets on the store.
Iāve finished a sizeable update, based on feedback and more extensive testing, which will be available shortly.
The āScriptingā section of the documentation now has a link to several helper/example scripts.
Two particularly useful components are the āAttach Transform To Splineā and āSpline Junctionā components. Which can be used to aid in road systems, or attaching a separate mesh to the start/end of a spline. This sort of functionality seems to be requested, but it is something I am hesitant to include or facilitate in this assetās scope, as they revolve around creative use of the Splines API specifically, not mesh generation.
1.1.0
Added:
- Demo scene, text description to each object explaining what is being achieved.
- Inspector UI enhancements.
- Option to regenerate the mesh on Start(), required when prefabbing procedural meshes.
Changed:
- Component no longer targets a Mesh Filter reference directly, now an output GameObject may be specified (automatically upgrades).
- Improved mesh generation performance by 120-300%.
- C#, static rebuilding events are now regular āActionā delegates.
- Scale tool now validates data points and resets them if a scale of 0 was found.
- Scale tool now supports multi-selection editing.
- A Spline Mesher component no longer requires 2 default scale data points. If no scale data is found, a default scale is assumed.
Fixed:
- Issue with geometry not generating for multiple splines if it uses more than 1 material.
- Vertex normals not being accurately rotated if the deformation scale was negative.
- Vertices at the very start/end of the spline possibly being deformed.
- Using a Box-shape collider with +1 subdivisions no longer shifts the collider when using the āSpacingā parameter.
- Mesh rotation not taking effect for a custom collider input mesh.
Example of the new inspector UI:
The 50% off release discount on the asset store runs out today!
I want to use it with the Easy Build System to allow players to create roads, rivers, bridges, and city walls. Can the two be compatible?
Based on the videos, possibly. I think the first question youād need answered is if it can create splines using its interaction system.
The game Farm Folks recently implemented something similar using Spline Mesher, so by all means it is possible
Hey, first of all, thanks for providing the community with amazing assets! I find myself using more and more of them.
Iām using this to spawn obstacles that match my terrain shape.
Is there a feature to have start/end meshes?
Imagine a bridge with start and end segments that provide ramps for the player to walk up or down the bridge.