Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[FREE] YAPP - Yet Another Prefab Painter (Open Source, GitHub)

Discussion in 'Assets and Asset Store' started by Rowlan, Nov 24, 2019.

  1. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    69
    Bug? Is Poisson Disk Distribution Mode broken? Prefabs appear offset in y-direction. Prefab is at 0,0,0, the container as well. "Center" is working correctly, so what can I do?


    Missing in the video: When I then move the container lower to "fix" it and continue painting, it's offset again on the same amount.
     
  2. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    That's odd. I just tried to reproduce, but couldn't. Which tree prefab are you using there? And what are the settings for it in the prefab section of YAPP?

     
    Last edited: Jan 6, 2021
  3. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    69
    Hey @Rowlan, Here are the settings in an album:
    https://imgur.com/a/PB3v8B5

    I'm using an empty GameObject, attaching the PrefabPainter and use that exact empty as the container as well. But I tried a different gameObject as container as well. Everything is at 0,0,0 I guess.
    Using "New" as a container (which creates a child) doesn't work either.

    + same behaviour when I use a different prefab.

    edit: I think I got it. The terrain is at y:-47 and the objects are placed 47 units too high. (I subtracted 47 to check)

    But it doesn't happen on "Center" Mode. Workaround for me: Place Terrain mesh on 0,0,0 and raise it for example. But it seems like a bug. Also: When I place my terrain on 50, the prefabs are placed 50 too LOW. So do you have a sign error here? :p
     
    Last edited: Jan 6, 2021
    Rowlan likes this.
  4. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    69
    To fix YAPP, you need to edit BrushModuleEditor.cs:417
    from
    Code (CSharp):
    1.  
    2.     // get terrain y position
    3.     float y = Terrain.activeTerrain.SampleHeight(terrainPosition);
    4.  
    to

    Code (CSharp):
    1.  
    2.     // get terrain y position
    3.     float y = Terrain.activeTerrain.SampleHeight(terrainPosition) + Terrain.activeTerrain.GetPosition().y;
    4.  
    Because after that, the position is simply set to:

    Code (CSharp):
    1.  
    2.     // create position vector
    3.      Vector3 prefabPosition = new Vector3( x, y, z);
    4.  
    And then, y is only the sampled height. The Terrain Transforms y-position is lost because of that. The incoming Vector "position" from the Raycast of course was correct, but sampling around the raycast-hit is done in the foreach loop.

    I just created a Pull-Request on your Github :)
    https://github.com/Roland09/PrefabPainter/pull/4
     
    Last edited: Jan 6, 2021
    Rowlan likes this.
  5. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    Thank you! :) Merged it. Gonna shift my demo terrain again. I had it before at y != 0 for exactly that reason, i. e. detect those kinds of errors. But at some point I must have reset the transform.
     
    KYL3R likes this.
  6. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    I changed the behaviour of the terrain alignment vs random rotation. Now they can be combined. But please keep in mind that the values should make sense depending on your gameobject.

    Example: I got the Camel Spider asset and wanted to fill a Lordenfel dungeon with it. It made sense to align the spiders on the walls. And also to rotate them in Y direction. But X and Z wouldn't make any sense here either, they'd just look as if they stuck inside the walls. So the settings you use pretty much depend on the context.

    Here's an example:



    Or final pics, filling the dungeon took just a few seconds:

    crowd 2.jpg
    crowd 3.jpg
     
    Last edited: Jan 16, 2021
    dsilverthorn and Lars-Steenhoff like this.
  7. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    I just had to paint in some snakes as well, literally took only a minute to do so :D

    scene 01.jpg
     
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,977
    Indiana Jones vibes!
     
    Rowlan likes this.
  9. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    This morning I started working on the Fence Builder I had on the roadmap.

    Turned out to be relatively easy with the fence prefabs of Meadow Enviornment:



    I'm gonna introduce more attributes to the prefab settings so that it can be generic (eg override the forward direction, etc) before I put it on GitHub.
     
  10. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    655
    Just in time for my latest project. :D
    I need to add street lights in a city. :)
     
    Rowlan likes this.
  11. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    49
    day-um man .. need to get something to take care of them spiders!!
    .. don't think I'll EVER be able to walk thru Lordenfel again without looking over my shoulder............
    <shiver>
     
    Rowlan likes this.
  12. Microck

    Microck

    Joined:
    Oct 6, 2015
    Posts:
    5
    Hello just let you know that the latest version give an error
    "Assets\PrefabPainter-master\Assets\Yapp\Editor\Physics\AutoPhysicsSimulation.cs(7,18): error CS0101: The namespace 'Yapp' already contains a definition for 'AutoPhysicsSimulation'" :D
     
  13. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    The physics stuff got extended and I had to refactor the code structure to keep it organized. There's probably a duplicate class now, I guess you just updated an existing version? Please delete the old one first before updating. I just installed into a new project and don't get that error. If you still get it, please post the complete console. Thank you :)

    Does anyone know if things like that happen if you install directly from GitHub? I guess I should try that.
     
    Lars-Steenhoff and Microck like this.
  14. Microck

    Microck

    Joined:
    Oct 6, 2015
    Posts:
    5
    Yeah it's fixed by deleting the entire folder.
    The new version is way better than the old one I was using. Thank you. ;)
     
    Rowlan likes this.
  15. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,977
    I have another idea, for grass placement on a mesh ( not terrain )
    If you could spawn grass prefabs in a grid on a mesh, in order to quickly have a mesh full of grass. ( with some random variation )
    Not sure how easy this would be?

    A bit like the paint bucket tool in photoshop
     
    Last edited: Apr 8, 2021
  16. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,861
    The poisson distribution basically does that, so it would be easy.
     
    Lars-Steenhoff likes this.
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,977
    If they could be placed only per material on the mesh that would make it great, I have for example a racetrack and around the track is a grass material where I would like the meshes the be created on the surface
     
    Rowlan likes this.
unityunity