Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Update to MegaShapes, build meshes from your splines.

Discussion in 'Assets and Asset Store' started by SpookyCat, Jan 11, 2012.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    Another quick update which fixes some issues with the Multi Mat Complex layer, layers that use that as a base now work correctly, and cross alpha values are correct. Also the fix has meant less vertices and polygons are used in Multi Mat Complex layers which is always a good thing.

    Changes in v1.90
    • Fixed the issues with using Multi Mat Complex layers as base layers for other layers such as clones, cross alpha values were not being calculated correctly.
    • Fixed Multi Mat Complex layer where too many vertices and polygons were being created, such lofts will be more optimized now.
    • Fixed issue where Multi Mat Complex layer would not give correct up values.
     
  2. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    New version of MegaShapes just submitted to the Asset Store, this brings a few bug fixes, as well as improvements to the MegaPathFollow script so that spline twist works correctly as do the offset and rotate values. Also added the suggestion above for updating the lofts when the mouse has stopped dragging, so there is a new option in the Shape inspector called 'Update On Drag'.

    Changes in v1.91
    • Fixed Path Follow script so it works correctly with spline twist.
    • Fixed Path Follow script so offset and extra rotation work correctly in all cases.
    • Added 'Update on Drag' option to MegaShape inspector, if checked spline meshes or lofts will update as you drag, off then they will update when dragging stops, for complex lofts this makes it easier to edit splines.
    • Fixed issues when creating a Clone Spline simple layer from the popup window. ie path and objects not being set
    • Fixed inspector for spline animations so buttons aren't hidden.
     
  3. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    I just purchased Mega-Shapes and appears that all of the scene files have an issue. I get the following error when loading the TrainSet scene and it comes in pretty messed up.

    Mismatched serialization in the builtin class 'Mesh'. (Read 214712 bytes but expected 214713 bytes)

    Attached is a screenshot of what the TrainSet looks like on load.

    All of the scenes in Mega-Shapes give me the Mismatched error and I get the errors on my PC and Mac Mini. I am using the latest build of Unity Pro and no other assets scene file or my own work is affected.
     

    Attached Files:

  4. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    Hi There
    If you could submit a support ticket at the website we can see what is going on.
    Chris
     
  5. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
  6. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
  7. anthonyk2

    anthonyk2

    Joined:
    Sep 18, 2012
    Posts:
    47
    Hi !

    I'm working on loft paths that are not closed, and I was previously using "cap start/end" materials to fill the sides. I'm now using the new Multi material layer, but I can't find the same option. Can't we fill the sides with this layer ?
    Thank you !
     
  8. stimul

    stimul

    Joined:
    Nov 28, 2013
    Posts:
    11
    Is it possible to import SVG at runtime?
     
  9. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    It would not take much to change the SVG import to work from a string as opposed to a file, it does that now basically by reading the file to string and parsing that, so if you have any basic scripting skills you could easily add a new method to do that, I can see about adding direct support in the next update.
     
  10. winterkewl

    winterkewl

    Joined:
    Oct 28, 2011
    Posts:
    53
    Hi @SpookyCat, I'm attempting to use MegaShapes Tracks Control to make some chains like bike chains but I'm having some trouble getting the links to behave correctly as they round a sharp corner in the path. I've attached a video of the problem which you can see the issue most prominently on the smaller gear on the right side of the video.



    Here are the settings for the Tracks Controller:


    And here are the settings for the curve:


    And finally here's how the curve looks at runtime:
     
  11. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    @winterkewl - If you could possibly submit a support ticket at our website so we can help you out.
     
  12. winterkewl

    winterkewl

    Joined:
    Oct 28, 2011
    Posts:
    53
    Thanks for the quick reply, support ticket sent.
     
  13. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    Hi SpookyCat I have some problem with loops. Can you help me? What I am doing wrong?

    loop_problem.jpg
     
  14. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    @Thre3ouls - If you could submit a support ticket at our website we can help you out.
     
  15. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    Ok thanks because I cannot figure out a solution.
    Ticket submitted.
     
  16. Praetorsoft

    Praetorsoft

    Joined:
    Oct 9, 2016
    Posts:
    14
    Is there a way to place prefab instances onto the loft? The closest thing I can find is the clone layer, but it only uses the meshes. I want it to place instances of a prefab, with its scripts and everything.
    I'm doing a racing game and I wanted to place my checkpoint prefabs automatically. Preferably with more instances in tight bends and somehow automatically increase an index counter in the checkpoint's script.
     
  17. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    @Praetorsoft - If you could submit a support ticket at our website we can help you out there.
     
  18. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    Below you will see a list of updates, bug fixes, performance improvements and changes since I last posted about an update in this thread, over 110 improvements, and many thanks to our users who have requested new features or changes or found bugs that have made it possible to keep improving MegaShapes and our other assets.

    Changes since v1.91
    • The Undo for MegaShapes now recognizes adding and deleting of knots as well other the other options that change the spline such as Autocurve, scale etc.
    • Fixed a bug where splines were being deleted if the 'Add' option was used when Loading a spl file.
    • Added OBJ exporter system to easily export loft mesh objects or any other mesh object, can also export animated meshes to OBJ sequences.
    • Updated MegaUtils.cs so if MegaShapes and MegaFiers installed their wont be missing methods.
    • MegaShapes made fully Unity 2017 compatible.
    • Changes made for the latest Unity 5.6 obsolete methods for the final release of Unity 5.6
    • Fixed a problem with the Position handles when editing splines.
    • Splines now default to Free Handle mode for editing.
    • MegaShapes is fully 5.6 compatible.
    • Fixed negative dist value in terrain carve component causing an exception.
    • Added new improved spline smoothing, you can now choose between old and new smoothing modes in the Shape Inspector. New method will produce a perfectly smooth spline through all the control points.
    • Added option to auto smooth the spline when you drag a knot, this will recalc the knot control points if you have changed any.
    • Lofts etc will auto update if a spline knot is deleted now.
    • Lofts etc will auto update if a spline is reversed now.
    • Rewritten the spline editing bit, making it easier to select and move spline knots and handles.
    • Move gizmos are now only shown for the currently selected knot.
    • To edit a spline knot you just need to click the green sphere for the point you want to edit, that will then select that point.
    • Option to freeze y movement when editing spline points, useful if using the free move handle type.
    • No need to click and drag mid point gizmos to add a new point you can now just click the circle to add a new knot.
    • Move handles now point along the spline.
    • Added extra circle gizmo at end of open spline for easier creation of splines by easily allowing addition of knot on the end.
    • Add Undo system for spline editing, you can now undo any changes made to a splines knots by clicking the Undo Edit Spline button.
    • Added option to set the max Undos that can be stored.
    • Added option to Walk Loft Smooth to use a raycast, useful if your loft is conformed to the ground or otherwise moved from the loft spline.
    • Fixed bug that caused splines to get corrupted if you tried to use the Spline animation builder on a spline with an imported animation.
    • Added the missing SetHandles method to the MegaShapes API.
    • MegaShapes fully Unity 5.5 compatible.
    • Layer field for the Rope collision field now shows all the layers correctly.
    • Fixed bug with rope collisions not using the selected layer value correctly.
    • Moved the New Hose system source file from the editor folder to the correct folder. You may need to delete the MegaHoseNew.cs file in the editor folder after an update.
    • Added new Hose Attach system that uses the new hose system.
    • Added a new version of the hose system that works correctly when end nodes are transformed or moved. Use 'Hose New' instead of 'Hose'.
    • Optimized the Lathe mesh builder.
    • Improved the Lathe Normal calculation system so it works correctly for all cases.
    • Fixed the mesh array size errors in the Lathe system when reducing the vertex count.
    • Fixed the Regex error in the SVG importer when building for a Windows Store App
    • Editing of splines is now disabled if an Alt key is down, stops accidental editing of splines while changing the scene view.
    • Added simple demo scene showing the RBody following a path component.
    • Fixed error with Spline Fill mesh when being used as a collider with zero thickness.
    • MegaShapes fully compatible with Unity 5.3
    • Train demo scene fixed so the train works correctly in Unity 5.x
    • Fixed main demo scene where one of the lofts had its rules disabled causing an exception.
    • Fixed a problem in Unity 5.x where zero length tris would cause an error and stop the collider being built.
    • Fixed exception in inspector if you happen to create a spline with no knots in it.
    • Added option to turn of the autosmooth when a new knot is added to the spline.
    • Also added the AutoCurve option when the Add Knot button is clicked
    • Fixed bug in the Lathe system where normals were pointing the wrong way
    • Fixed exception bug in the spline notify system that could appear when loft layers which do not use crosssections are used.
    • Added conform option to the Clone spline layer so can now easily make fences etc fit the terrain
    • Added conform option to the Clone spline Rules layer so can now easily make fences etc fit the terrain
    • Added conform option to the Clone spline Simple layer so can now easily make fences etc fit the terrain
    • Added conform option to the Scatter spline layer so can now easily make fences etc fit the terrain
    • Changes for Unity 5.1, removal of obsolete items etc.
    • Fixed CrossSection lines not showing for Complex layer type.
    • Fixed MegaShapeLightMapWindow problem when doing an app build.
    • You can now build lightmap data for MegaShape standard meshes.
    • Changed OSM importer to use ulong for ids instead of int so can now handle complex OSM files.
    • Added a new demo scene to show a RBody being controlled by a spline. Car model kindly provided by www.uistudios.com
    • Fixed Shape labels being displayed if behind the camera.
    • Added a beta OSM data importer. Click the Assets/Import OSM option.
    • Added example script showing how to move a RigidBody object along a spline with forces.
    • Added FindNearestPointXZ and FindNearestPointXZWorld methods to MegaShape API.
    • Improved Move RigidBody along spline system example script MegaShapeRBodyPathNew, note it is an example script for you to base your own on.
    • Added a break force option to RigidBody spline follow.
    • Added more options to the Move Rigidbody along a spline script.
    • Changed Clone Spline simple so position of layer is not linked to spline position, no need to duplicate the spline if used multiple times.
    • Changed Clone Spline so position of layer is not linked to spline position, no need to duplicate the spline if used multiple times.
    • Changed Clone Spline Rules so position of layer is not linked to spline position, no need to duplicate the spline if used multiple times.
    • Fixed exception if trying to build a mesh with a shape with no splines.
    • Fixed exception if trying to interpolate along a shape with no splines.
    • Fixed exception if trying to interpolate a spline with no knots.
    • Remove the SetActive warning from Draw Loft Component.
    • Added in the Mega Mesh Page component.
    • Added a new Scatter system (MegaLoftScatter) to allow you to scatter complete objects onto lofts.
    • Tweaks to the Draw loft and Draw Spline components.
    • Autocurve fixed so the last knots handles on an open spline are correct.
    • Added a Draw Spline example script to make splines by drawing with the mouse at runtime.
    • Added a Draw Loft example script to make new lofts by drawing with the mouse at runtime.
    • Added a demo scene showing the draw spline system.
    • Added draw loft example to the first tutorial scene.
    • Fixed some potential errors in the constant speed interpolation.
    • Smooth value is now a slider and shows results in realtime for easier use.
    • Fixed Terrain Carve gizmo being offset from the loft.
    • Fixed exception when first adding a terrain object to the terrain carve system.
    • Made the default curves for the terrain carves correct for left and right.
    • Terrain carve now works with open lofts.
    • Terrain carve outline splines now use same interpolation settings as the loft spline for better results.
    • Terrain carve Conform button will not appear in the inspector until the Save Heights button has been clicked to save confusion.
    • Fixed bug in the WalkLoft GetLocalPoint method where it was not using the passed dist value.
    • Fixed bug in the WalkLoftSmooth GetLocalPoint method where it was not using the passed dist value.
    • Added GetPoint method to WalkLoft to get any point on the loft, as opposed to the GetLocalPoint which is relative to the current walk loft position.
    • Added GetPoint method to WalkLoftSmooth to get any point on the loft, as opposed to the GetLocalPoint which is relative to the current walk loft smooth position.
    • Further small changes to make compatible with Unity 5.0
    • Fixed import warnings for the latest Unity 5 beta.
    • The Clone Spline layer now works with the spline twist values.
    • Fixed exception when adding a new curve to a shape.
    • Added option to Spline Tube Mesh to flip normals for inside tubes.
    • Added option to Spline Box Mesh to flip normals for inside box tubes.
    • Added option to Spline Ribbin Mesh to flip normals.
    • Added a method GetLocalPoint(float dist, float crossa) to WalkLoft script to allow you to easily get a point on the loft in the local space which can be used for steering controls etc.
    • Added a method GetLocalPoint(float dist, float crossa) to WalkLoftSmooth script to allow you to easily get a point on the loft in the local space which can be used for steering controls etc.
    • Imported SXL splines will now no longer change values to centre the spline.
    • Imported SVG splines will now no longer change values to centre the spline.
    • Added Centre Shape button to Shapes Inspector to allow you move the pivot to the centre of all the points.
    • Fixed a bug in the MegaShapeFollow script when using the option to rotate objects to align to the spline.
    • Added new InterpCurve3D method which will return the postion, twist and also rotation quaternion for a point on a spline.
    • Fixed exception in Terrain Carve if no Loft Layer selected.
    • Fixed exception if you loaded a spline file with fewer splines in it to a shape that was being used by a loft that used a deleted spline
    • Fixed an exception bug when duplicating layers.
    • Updated code for Unity 5.x
    • Autocurve now does the first and last handles on open splines.
    • Small fix for Unity 4.x where loft layers were not updating when a spline was edited.
     
  19. Praetorsoft

    Praetorsoft

    Joined:
    Oct 9, 2016
    Posts:
    14
    I created a ticket, but today I found the MegaLoftScatter script and I guess this is the one I want. I made a copy of it and tweaked it to my needs, works good. Though there is a problem throwing ArgumentOutOfRangeException from time to time. I created a new ticket with a detailed description.
    If it helps someone, the problem occurs when using MegaLoftLayerMultiMat and some materials are disabled. If an object is scattered onto that material it crashes (due to 0 vertices). Can also happen if the objects are at the extremities of the cross spline. Set cross Start/End in the LoftScatter a tiny bit inside the spline to take care of that.
     
  20. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687
    Can this asset handle junctions and intersections? I would like to make a road system that conforms to the terrain below, but I need more than just a single path.
     
  21. Nunggi

    Nunggi

    Joined:
    Apr 7, 2018
    Posts:
    7
    We're building a track using Line Shape.
    Use the Add Knot or Delete Knot in the
    Some of the tracks we build are changed automatically.
    I want to know how to solve this problem.
     
  22. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    Hi I have a red error that occur after importing megascatter in my project were I already have megashape.

    Assets/MegaShapes Test Scene/Scripts/FreeCamera.cs(4,14): error CS0101: The namespace `global::' already contains a definition for `FreeCamera'

    This error prevent me to work. How can I fix it?
     
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    Delete the FreeCamera.cs script it is just used by the demo scene. In the next update I will namespace that script so there is no problem.
     
    Thre3ouls likes this.
  24. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    Superb support. I open a support ticket using the website support form and Chris reply to me in less that 5min. He give me a lot of possible solution and first one works perfect.

    Thank you Chris
     
  25. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    5 Stars support.
     
  26. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
  27. Thre3ouls

    Thre3ouls

    Joined:
    Apr 13, 2016
    Posts:
    22
    I have some other red error in MegaScatter. I replayed to your last email. Do I need to open a new ticket with the new errors?

    A.Adamoli
     
  28. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,448
    I'm currently using a different spline solution which I'm not really happy with, so I'm looking for a replacement. @MikeUpchat made me aware of MegaShapes and it does look really useful and might be the replacement I was looking for.

    Unfortunately, I'm unable to find an answer to the following questions in the documentation:
    1. Can I change the width of the generated path/mesh per spline anchor? I want to build a race track with different widths along the path.

    upload_2020-10-22_8-35-10.png



    2. If your solution supports to specify per-anchor width, does it suffer of the following issue, where the generated mesh "folds":

    upload_2020-10-22_8-41-30.png



    3. Can I connect multiple splines to create junctions? So when I move the point of a spline that is connected to a point of another spline, that it moves the point of both splines. I'm only looking for the editor tooling side here, I don't need prebuilt components that would follow the path and change splines.

    upload_2020-10-22_8-37-39.png



    4. Is your solution able to handle 90 degree'ish curves? Other solutions often can't handle that.

    upload_2020-10-22_8-46-6.png
     
    Last edited: Oct 23, 2020
  29. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    MegaShapes has a few options to allow you to control the width of the loft, there is a curve that can be used to define the width of the loft along the length of the spline, or if you are using multiple cross sections then you can define the width of each cross section, you can see some of that in this video


    The track building videos don't show the track changing width but as with all the other params in MegaShapes they can be adjusted at anytime so the track in the video below could very easily have its width changed at any point via the scaling curve/s


    The fold you show seems to be caused by Gimbal lock, again MegaShapes has a couple of optiopns, you can define the Up value to remove folds caused by gimbal lock, or you can use the second 'Transport' mode option where the up values is constantly recaluclated along the length of the spline to gurantee no gimbal lock folds, the only issue with that is for looping splines you will have to adjust the twist on the spline to get the ends to line up.

    Currently MegaShapes does not have a junction system built in as it has not been asked for before, but a very simple script could be added to allow for the first and and last points of a spline to be bound to another spline, I used such a thing when doing my Traffic AI system to automtaically join the roads up for the meshes as well as the traffic paths.


    As for the last problem, that is an issue that no spline system I know addresses even in packages such as Max, Maya and Blender its is a non trivial problem to solve especially in a general lofter, if you are just doing roads then a custom solution can be achieved fairly easily but for a general lofter where the cross section is not known it is pretty tricky.
     
    Peter77 likes this.
  30. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    Thanks for the great plugin. I am trying to insert in some cross sections into a complex loft during runtime. I am able to add in a new MegaLoftSection, but am unable to set the alpha values for the loft after I have added in the section. They all get set to 0, even though that's not the value they are being assigned.

    If I run a coroutine and wait two frames, I am able to adjust the alpha values for the sections.

    Currently I am just adding directly to the Loft.Layers[0].sections[0]. Then looping through and modifying the alpha values.

    Is there a better way to do this? Is this just wrong?

    I am attempting to create infinite rolling ground for a runner and I like the idea of adding in a randomize section to the end and removing the start section in order to have an infinite terrain.
     
  31. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    Figured out I needed to make sure I added a curve before adding it to the loft. Seems like it's working now.
     
  32. siliconkgk

    siliconkgk

    Joined:
    Oct 5, 2021
    Posts:
    27
    Hi, Is there a way to apply a physics material to the side rail lofts in megashapes or modify the collider properties at all??
     
  33. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,689
    If you need different colliders with different properties then you will need to make different loft objects. You can make one loft for the visible mesh and then make other lofts for the side rails and disable the meshrenderer and leave the collider mesh as well.
     
    siliconkgk likes this.