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

Ferr2D Terrain Tool

Discussion in 'Assets and Asset Store' started by koujaku, Oct 9, 2013.

  1. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I often have the following message when exiting playmode and I don't know why. Can someone help me with that ?

    Thanks

    "NullReferenceException: Object reference not set to an instance of an object
    Ferr2DT_PathTerrain.RecreateCollider2D () (at Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs:592)
    Ferr2DT_PathTerrain.RecreateCollider () (at Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs:510)
    Ferr2DT_PathTerrain.Build (Boolean aFullBuild) (at Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs:353)
    TerrainTracker.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Assets/Plugins/Ferr/2DTerrain/Editor/Ferr2DT_Builder.cs:13)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:27)"
     
  2. frankiecavanagh

    frankiecavanagh

    Joined:
    Dec 13, 2015
    Posts:
    11
    Is there a way to create a prefab which contains 3D prebuilt colliders?

    When I turn an object with terrain into a prefab after clicking "Prebuild collider" then instantiate it at runtime, the Mesh field of the Mesh Collider is "None" and my character falls through the floor.
     
  3. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Great update 2.0

    I have one idea

    Ability to automatically distribute objects along a ferr terrain edge.

    For example in this image the grass objects could be attached to the terrain an automatically distributed along the top edge of the terrain.
    this could make level creation even easier.

    you could for example select a few objects and they will be randomly distributed with a falloff rule.

     
    AlcyonGames likes this.
  4. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    Just installed your latest update into an existing 2017.2.1p2 version project and I got a ton of error in the Ferr2DT_Caps.cs file. They are all referencing missing EditorTools issues:

    Assets/Ferr/2DTerrain/Editor/Ferr2DT_Caps.cs(40,144): error CS0117: `EditorTools' does not contain a definition for `ImageCapBase'

    Assets/Ferr/2DTerrain/Editor/Ferr2DT_Caps.cs(87,27): error CS0117: `EditorTools' does not contain a definition for `GetGizmo'


    I also got one in the Ferr2DT_PathTerrainEditor.cs file again referencing a missing EditorTools issue:

    Assets/Ferr/2DTerrain/Editor/Ferr2DT_PathTerrainEditor.cs(202,17): error CS0117: `EditorTools' does not contain a definition for `DrawPolyLine'


    I remove the asset and reinstalled and got the same error. Any ideas?
     
  5. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Hey Kiupe! What version of Ferr2D are you using?

    Normally, procedural mesh data is saved in the scene file, but when objects are turned into prefabs, you can't attach it to any one scene, and so Unity just doesn't bother saving it at all! I have a ton of code to get it working for the visual mesh by saving the meshes to asset files, but I haven't extended that code to include the mesh colliders.

    This is an excellent idea that comes up every now and again, and it's a bit easier for me to do with the current code-base! I'll definitely be considering this one for the next update :)

    Sounds like your EditorTools file is still out of date! I've double checked the build package, and everything looks good to go. You may want to retry deleting and re-installing again. Make sure you get the whole Ferr folder, not just Ferr/2DTerrain!
     
    AlcyonGames likes this.
  6. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I deleted it again, refreshed my browser page, told it to open in Unity, instead of just opening in Unity like before. Once the package contents displayed, I compared them to the list in the store and it showed all folders/files in package. Did the install and got the exact same errors.
     
  7. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I can see the ImageCapBase code starting on line 447 in the Ferr/Comm/Editor/EditorTools.cs file so it does exist.
     
  8. ahmed_decoy

    ahmed_decoy

    Joined:
    May 19, 2013
    Posts:
    58
    Update looks great! I just want to add a bump to this post as I'm also very interested in seeing a tutorial video on using Vertex Painter + Ferr2D

    Keep up the good work!
     
  9. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hello,

    I was using 1.12 and I just updated to 2.0. Now the project can compile anymore, I have the following errors :

    Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs(13,34): error CS0246: The type or namespace name `ILerpable' could not be found. Are you missing an assembly reference?

    Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs(35,27): error CS0246: The type or namespace name `Path2D' could not be found. Are you missing an assembly reference?

    Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs(1663,90): error CS0246: The type or namespace name `PointType' could not be found. Are you missing an assembly reference?

    Assets/Plugins/Ferr/2DTerrain/Scripts/Ferr2DT_PathTerrain.cs(1679,68): error CS0246: The type or namespace name `PointType' could not be found. Are you missing an assembly reference?
     
  10. abuki

    abuki

    Joined:
    Nov 14, 2013
    Posts:
    40
    Hi, how could I get smooth tangent or normal for a specific point on a curve? I want to raycast under the character, find the closest point on the path to that raycast hit and then get normal (or tangent?) of that specific point, which might be somewhere in the middle of the segment.

    I found there is a method
    PathData.GetNormal() but I am not sure how to use it, and from the code, it looks it just returns the normal for that specific point, but I want smoothed point between segment points.
     
  11. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    I'm not sure what's going on with your project, but something is still messing up your installation. Try installing it in an empty Unity project, and see if that fares any better.

    Unity's raycast actually provides you with a normal already! Physics2D.Raycast returns a RaycastHit2D object ( docs here ) which contains the normal at the intersection location. The 3D raycast equivalent does the same if you're using that! And of course you can transpose that easily for the tangent if you still need it :)
     
  12. abuki

    abuki

    Joined:
    Nov 14, 2013
    Posts:
    40
    But the raycast give me normal to the polygon collider (which is made from flat segments) and not the path (bezier) curve itself. And that is my question, how to get normal to the path curve? I suppose it will be more precise since the precision of raycasthit itself depends on the density of polygon collider vertices. So I was thinking about finding the closest point on the path to that hit and get more precise normal from the path, which in my case is made mostly using bezier curves. I Hope, I wrote it understandable.

    Btw - I was using ferr2d a few years ago last time, and the new bezier curve feature is something I was missing so much. Great work!
     
  13. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I imported the Ferr Asset to a new Unity 5.6 project and it imported fine, no errors. I then copied the folder to my 2017.2.1p2 project and the original errors still showed up.
     
  14. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    283
    I can't seem to get 3d collided to work in ferr 2.0 ?? I can collide from under for some reason but fall through the top.
     
  15. LavieA

    LavieA

    Joined:
    Apr 25, 2017
    Posts:
    4
    Hello! everytime I enter the material editor, it swaps to the simple mode and I have to input all my sprites positions again ):

    using 2.0 and unity 2017.3
     
  16. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Thanks! I wish I had shipped with the Bezier stuff originally, but I don't think I would have done it justice back then :)

    So because I don't use pure Bezier curves (I mix with arcs and stuff like that) I don't do many calculations against the mathematical representation of the path. I also don't much relish the thought of doing ray/bezier intersection math, which I suppose you'd need if you were to get truly precise data.

    What you could do is grab the line segment, calculate the distance between them and the hit point, and then blend the normals based on that. For any reasonably dense collision object, that should be pretty darned precise. How much precision do you actually need?

    I'll confess I haven't tested 2017.2! 5.6 is my primary development version, and I definitely did a lot of testing in 2017.3. I'll see if I can try out 2017.2, any reason you're sticking with that version?

    Is your character standing inside the collider when it starts? That will often create this type of behaviour.

    Could you share your material settings before they reset? You can email them if you don't want to do it on the forum, but it'd be helpful. Detecting 'Simple Mode' is a little weird, but I thought I had gotten rid of all the edge cases. I've been considering getting rid of simple mode altogether, but I'm hoping to re-write that whole material editor sometime soon regardless.
     
  17. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    Hey @koujaku I know you just got done with 2.0 so you probably deserve a break! but I was wondering if you have an ETA for the subtraction path feature? If it's how I imagine it working it's going to be super useful for my game
     
  18. abuki

    abuki

    Joined:
    Nov 14, 2013
    Posts:
    40
    I was thinking about finding an intersection with the collider and then finding the closest point on (bezier) path to that hit. That should not be a big problem.

    Since this is undocumented, can you just point me briefly in to the right direction? A very basic sample of code? What are line segments in your case? Segments between control points? I don't know how much precision do I need, I just wanted to try if it could be better then getting it from raycast hit normals.
     
  19. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I'm pretty far into the development and didn't want to upgrade to 2017.3 at this time. I do have 5.6, 2017.2 and 2017.3 all installed so I'll make a test copy to upgrade to 2017.3 and see how that goes.
     
  20. AlcyonGames

    AlcyonGames

    Joined:
    Sep 16, 2016
    Posts:
    39
    This is an amazing idea!, great!
     
  21. AlcyonGames

    AlcyonGames

    Joined:
    Sep 16, 2016
    Posts:
    39
    I have a little question koujaku, but first let me congratulate you on this update, it blew my mind how the asset improved so much, it even performs better. (I'm @tryintodraw on twitter and @AlcyonGames)
    My question is if there is no more a "randomize edge by coordinates" or something like that was called. The thing is that I want to duplicate the terrain and put it 0.2 behind and on top of the real terrain, to simulate 3D like this game:

    if you look closely the terrain is duplicated several times to achieve that look. The problem is that when I duplicate the terrain is exactly the same segments, I already experimented with the previous version and it looked fine if I used that option the "randomize edge..." that way it didn't looked like this:

    It looks like radial blur haha, because it's the same cloned terrain. It would look more organic if the segments were different. I know I can do it manually, but with the option before it was just a click away.
    Congratulations again! Awesome update.
     
  22. Testeria

    Testeria

    Joined:
    Aug 15, 2013
    Posts:
    18
    Feature request (or maybe it is possible with current version or some unknown to me unity feature):
    - possibility to add "guides" with exact distance from terrain (visible only during construction).

    That way I could set them on certain value (for example two of them: high jump and normal jump) and that would ease and speed development a lot (I would now where to put higher level of terrain to make it difficult or easy for the player to jump, etc.).

    Sorry for my bad english, hope it is understandable...
     
  23. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    I have the same flickering issue which I see others mentioned.
    I have tried various things which was suggested like the z axis but it's already 0.05 and that didnt solve it.
    Regards
     

    Attached Files:

  24. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    Hi, doesnt duplicating like that affect your performance?
     
    AlcyonGames likes this.
  25. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    We noticed that this seems to happen when two terrains that are overlapping (and sometimes not overlapping) share the same sorting layer and order. The flickering goes away if we ensure the affected terrains have different sorting orders.
     
    Last edited: Mar 24, 2018
  26. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    How Can i change that on the edge and fill of the same Terrain?
     
  27. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    You can’t. Like I said, for us the problem was multiple terrains sharing the same layer. I know that doesn’t make sense when it’s the edge and fill of an individual terrain that is flickering (perhaps it is to do with unity trying to batch things), but that’s what solved it for us. In your screenshot are all the terrains using different sorting orders?
     
  28. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    In your previous response you said that, this happens when two terrains are over lapping. In my example there's only one terrain with a fill and an edge, is that what you consider to be over lapping?

    All my platforms are sharing a platform sorting layer and moving platforms sharing a moving platform sorting layer.

    Are you suggesting to create probable another platform sorting layer and add a few of them to it?
     
  29. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    No. I’m saying change the sorting *order* of the terrains. That’s the number beside the layer in the inspector.
     
  30. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    Ok, i changed the order of the background and foreground in that menu. Hope thats's where you meant
     

    Attached Files:

  31. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    No, sorry that’s not what I mean. In the inspector for your Ferr2D terrain object, in your scene, you can select the sorting layer (name) but also the sorting order (number). That’s the place I’m suggesting you look. If multiple terrains are using the “Platforms” layer and are also set to sorting order “0”, try setting the sorting order to different values for each terrain. Not the layer name. The order within that layer.

    https://docs.unity3d.com/ScriptReference/Renderer-sortingOrder.html
     
  32. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    OK I see it, so if I have 50 terrain objects try setting some to 0 and some to 1? or just number them from 1-50 (which is hard work).
    I should mention this doesnt happen on the pc, only when exported to my phone
     
  33. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    I went thru my game object and added 1 (n+1) for every item, then i ran it and there was no flickering.
    Must say, very hard work, has the developer said something that could sovle this yet?
     
  34. MinnieMoog

    MinnieMoog

    Joined:
    Mar 25, 2017
    Posts:
    3
    Hi all

    Does the Ferr2D community have a Discord server? If not, is this something anyone's interested in? I haven't found one yet. :)

    Thanks!
     
    Haapavuo and Too-Nerd-To-Die like this.
  35. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    If I can remember two updats aback, my ferr2D collision begun appearing like this. the problem this causes is that it allows my character to fall thru the "cracks" . Has anyone been able to revert to how their collision once was? or is there a setting i need to disable or enable?
    Please refer to the attachment.
     

    Attached Files:

  36. BACALL

    BACALL

    Joined:
    Feb 21, 2017
    Posts:
    79
    He made a huge update to the collision in Ferr2D, actually a really good update. You need to open the material editor in (aka Ferr2DT Editor) and change play around with the collider settings and you can gett stuff like this:
    Skärmavbild 2018-03-29 kl. 21.54.16.png
     
  37. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    Yea i noticed those but I can still jump thru if I try hard enough
     
  38. AlcyonGames

    AlcyonGames

    Joined:
    Sep 16, 2016
    Posts:
    39
    Sorry for the late response, we're currently testing but so far, not a big performance problem. Occlussion Culling + Back Face culling is helping a lot ;)
     
  39. Travis-Goetz

    Travis-Goetz

    Joined:
    Feb 5, 2015
    Posts:
    7
    Apologies if this has been asked already, but does anyone know of a method to make Ferr2D terrain work with sprite masks? https://docs.unity3d.com/Manual/class-SpriteMask.html

    Masking was added kinda recently so I wasn't expecting it to be in this yet. For a normal sprite, you just have to set the Mask Interaction" property on SpriteRenderer. Is there a way to add a public variable for that (under Terrain Data / Visuals)?
     
  40. BACALL

    BACALL

    Joined:
    Feb 21, 2017
    Posts:
    79
    Try setting the Collision Detection of the Rigidbody to Continuous. I guess you could also try checking the "Fill Collider" bool under the Collider tab in the terrain inspector
     
  41. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    95
    Hey Ferr2D developers!

    Your asset seems very nice and we are interested in buying 2 licenses. Would there be a limited time discount for the price in near future? :)

    EDIT: +1 for the Discord server.
     
    Last edited: Apr 4, 2018
  42. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    Have to put a screenshot on here because I absolutely love this tool. The new updates are excellent! Thank you very much :)

    upload_2018-4-5_19-58-1.png
     
    Spiderwork likes this.
  43. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    95
    Regardless of the non-existing communication from the developers, we decided to buy 2 copies of Ferr2D.

    And immediately we ran into problems. We are having terrible z fighting with Orthographic cameras and Z Offset setting in Ferr 2DT_Path Terrain doesn't help at all. Also the Sorting Order setting of MeshRenderer does not help.

    At some camera positions the fill appears to be on top of the edge and vice versa.

    How to fix this?

    Also visible in the Scene view as shown in the screenshots...

    Unity_2018-04-12_18-54-48.png Unity_2018-04-12_18-55-07.png
     
    Last edited: Apr 12, 2018
  44. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    Can't see the screenshots so hard to help, but see my post further up the page. Have you got multiple terrains sharing the same sorting group and order? We've found that the flickering goes away if terrains don't share identical sort order settings.

    (I'm fairly sure this is a Unity issue rather than Ferr2D)
     
  45. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    Hello,

    First I just have to say I love this tool. It's a big time saver and really amazingly implemented. And I absolutely love the new updates (specially the ability to select and edit multiple points). I even bough again the asset on another account I have :)

    Secondly, I would like to ask how can I set a default physics material? When we check the box to "'Fill collider" we can set the physics material, but doing this it generates a second collider. And then the physics material set there will apply only on the second collider (the filled one), but the first collider is still without material. There are a few problems with this:
    - since both colliders generate are overlapping the top surface of the, the behaviour of some objects are acting a bit wrong. Some objects will interact with the filled collider (with the material I set) and some objects will interact with the collider without material.

    So I ask, why I cannot set the material to the first collider? (the not filled one). And also, if I set the "Fill Collider", why does it still needs to generate the first collider?

    In my opinion, the best way would be if I was able to set the physics even for not filled terrain. And if I set the "fill collider", I don't see a reason on why still generate the first collider.

    Please let me know what you think, maybe I'm not using this properly.

    Cheers,
    Sergio.
     
  46. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    95
    In addition to this, I will have to add a Sorting Group to each one to make sure that each of the terrain objects are still rendered at order 1... This is tedious and I bet also not very performant.

    But... I guess we have no choice. I am going to try this method and then report back.
     
  47. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    95
    It seems like setting each terrain on their own sorting order fixed the problem. Thank you.
     
  48. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    Same. but like you mentioned, VERY tedious
     
  49. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47
    I see there is a new update and i cant seem to find the list of changes anywhere except this
    "UPDATING: This is a large update, please delete old Ferr2D and re-install plugin! It is backwards compatible with terrain objects, v1.x terrains will behave exactly as they did before, and will have an "Upgrade" button. New terrains can exist side by side with old ones. v2.0.2 2018-4 +Bug fixes -Fixed physics materials occasionally getting mis-assigned -Gizmos were showing up in incorrect locations on Infinite Terrain Chunks"

    Is this all?
     
  50. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    The message about it being a large update is in reference to the 2.0 update.

    The 2.0.2 update has only the 2 bug fixes listed