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
  4. Dismiss Notice

AI [Released] PathBerserker2d - 360° platformer pathfinding

Discussion in 'Tools In Progress' started by PathBerserker2dDev, Jul 14, 2020.

  1. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Okay this is weird. Unity has only send me an email to notify me of your last post GiomGots.
    I have to remove the link to this thread from the store page I think. Direct email will be more reliable.

    I'll go through all of the recent posts asap.
    I'm very sorry.
     
  2. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    You can either use a NavSegmentSubstractor (https://oribow.github.io/PathBerser...PathBerserker2d_1_1NavSegmentSubstractor.html) if you want to remove the navigation at that point permanently while baking.

    Or you can use NavAreaMarker (https://oribow.github.io/PathBerser...on/classPathBerserker2d_1_1NavAreaMarker.html) if you want to move/remove the obstacle at runtime. Or want certain characters to ignore the obstacle.
     
  3. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    I think you wrote me a direct email with the same topic, which I answered. So I think this is solved. If not, please write me again.
     
  4. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Hi,
    not sure if you haven't seen, but I have send you a pm.
     
  5. Ulugbek1992

    Ulugbek1992

    Joined:
    May 16, 2019
    Posts:
    2
    It's a shame that I was not able to use this in Unity 2018((
    apparently did not support it all the same.
    I know this is not the package's fault and that it works fine in newer versions of Unity
    but my game has been created for a long time in Unity 2018.
    Can I somehow make this awesome asset work with Unity 2018?

    sorry for my English
     
  6. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    There is only one roadblock that stands in the way of supporting a unity version before 2019. But its a major one.

    https://docs.unity3d.com/ScriptReference/Collider2D.CreateMesh.html
    Does not exists prior to 2019. Without it, my asset can't generate the nav shape from the 2d colliders.
    It would be possible to rewrite this function per hand, but that is quite some work.

    So here is a deal. If you (or anyone else) can write an implementation of Collider2D.CreateMesh that works like the 2019 version, then I will integrate it and publish a 2018 version of my asset and give you a free copy!
     
  7. Ulugbek1992

    Ulugbek1992

    Joined:
    May 16, 2019
    Posts:
    2
    Yes, you are right, it may not be the easiest way.
    Easier to update the engine.
    Thanks for the answer anyway!
    and thanks for the development of PathBerserker2d !, as there are very few opportunities to give life to 2D NPCs these days.

    and yes, it would be very cool if you add NodeCanvas or FlowCanvas integration.
    With the help of which it would be possible to refer to agents through the NodeCanvas.
    eg:
    Go, Wait, Follow, Interrupt Target or Path, Change. etc
    This can be done in the usual way through C #, but when you prototype a game, quickly building logic through visual programming just saves!
    yes that would be very cool...
     
  8. foobooio

    foobooio

    Joined:
    Oct 14, 2018
    Posts:
    5
    Will this work with webgl?
     
  9. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    foobooio likes this.
  10. grinsmilestudio

    grinsmilestudio

    Joined:
    Aug 11, 2021
    Posts:
    1
    Hi, I would like to ask. Is there any requirement version for Corgi?
     
  11. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Hi, sorry for your wait. I just don't get any emails for this thread anymore. IDK why.
    If this still matters, Corgi support was developed with Corgi v6.7. I'd guess it works with newer and older versions, but I'm not sure. If you find it not working for you, I'm happy to look into fixing it or offer a refund.

    For OTHERS who want to ask me a QUESTION: Please write me an email as a sure fire way to get an answer quickly.
     
  12. yehiaserag

    yehiaserag

    Joined:
    Mar 8, 2018
    Posts:
    6
    I've sent you an email about a bug that I faced in baking, do you still check the mail or do I have to message you here?
     
  13. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Hi,
    I usually reply to emails within a day or two. Can you PM me your Email address? Maybe I overlooked your mail or it went missing somewhere.
     
  14. squiDan

    squiDan

    Joined:
    Apr 27, 2022
    Posts:
    4
    Hi,

    First of all, kudos on the asset, It helped me tremendously setup my character’s movement and navigation around the level.

    Now on the the issues:

    I’ve emailed you twice in the past couple of weeks and haven’t heard back. Maybe I’ll have better luck here in the forums.

    I’ve integrated PathBerserker2d into my game and I ran into an error that I believe is a bug in your code. Could you please look into it? Unity throws a KeyNotFoundException whenever I disable a GameObject that contains a NavSurface and NavLink components in them.

    Steps to Reproduce:
    1. Open the complete_example scene included in PathBerserker2d.
    2. Run the game.
    3. Select Moving Platform Tower Surface GameObject in the Hierarchy panel.
    4. Click on the checkbox in the Inspector panel to disable the selected GameObject.

    Result:
    The following error appears in the console.

    KeyNotFoundException: The given key was not present in the dictionary.
    PathBerserker2d.NavGraph.RemoveSoftRefLink (PathBerserker2d.INavLinkInstance link, PathBerserker2d.NavSurface targetSurface) (at Assets/PathBerserker2d/Scripts/PathBerserker2d/NavGraph/NavGraph.cs:514)
    PathBerserker2d.NavGraph.InternalRemoveNavLink (PathBerserker2d.INavLinkInstance link, PathBerserker2d.NavSegmentPositionPointer start, PathBerserker2d.NavSegmentPositionPointer goal) (at Assets/PathBerserker2d/Scripts/PathBerserker2d/NavGraph/NavGraph.cs:527)
    PathBerserker2d.NavGraph+RemoveNavLinkChange.Apply (PathBerserker2d.NavGraph graph) (at Assets/PathBerserker2d/Scripts/PathBerserker2d/NavGraph/NavGraph.cs:693)
    PathBerserker2d.NavGraph.Update () (at Assets/PathBerserker2d/Scripts/PathBerserker2d/NavGraph/NavGraph.cs:101)
    PathBerserker2d.PBWorld.Update () (at Assets/PathBerserker2d/Scripts/PathBerserker2d/PBWorld.cs:75)

    Expected Result:
    The GameObject is disabled without any errors.

    This is urgent because your asset is a fundamental piece on my game and this is currently a blocker.

    The other feedback I have is that the documentation could be improved.

    Thank you so much!
     
  15. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Hi,

    I haven't received you mails, but got the notification for your post on here. I don't know why that happens sometimes. I have received emails from other people in the last weeks just fine. I've reproduced this error and fixed it. Update should becoming the next couple of days.
    Thanks for your patience. Also very much thank you for the detailed bug report. Made it a breeze to find the issue.

    Cheers
     
  16. squiDan

    squiDan

    Joined:
    Apr 27, 2022
    Posts:
    4
    Thanks for the quick turn around releasing the update. I already got it.

    Well, that's concerning. Did you check your spam folder? I've emailed you explicitly because you said here in the forums and on your asset product page to do so because you have problems receiving messages and that email would be best. And now you're saying sometimes you don't get those either. Please look into that, because it's not very reassuring to think that we may or may not be able to get a hold of you.


    I can confirm that the error I reported has been fixed. But there are more. Please check your inbox and look for an email title MissingReferenceException and KeyNotFoundException when SceneManager.LoadScene is called . I'm trying to avoid posting snippets of your source code in the forums.

    Thanks for your time!
     
  17. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Ah there it is. I feel really stupid now for never bothering to look in the spam folder. Yeah, your emails where flagged as spam. I can see all 3 of them now. Lets continue this via email then.
     
    squiDan likes this.
  18. squiDan

    squiDan

    Joined:
    Apr 27, 2022
    Posts:
    4
    No worries. It happens ;). The errors I reported have all been fixed as of v2.4.5. Thank you very much for your support @PathBerserker2dDev!
     
  19. fabiopov_1

    fabiopov_1

    Joined:
    Jan 2, 2018
    Posts:
    11
    Hello everyone,
    whenever I try to generate a navmesh, regardless of unity version and operating system I always get this error :

    Mesh '': abnormal mesh bounds - most likely it has some invalid vertices (+/-inifinity or NANs) due to errors exporting.
    Mesh bounds min=(-nan(ind), -nan(ind), 0.00), max=(-nan(ind), -nan(ind), 0.00). Please make sure the mesh is exported without any errors.


    This basically makes the product useless!
    I've already written an email to support but still unfortunately i haven't received a reply.
    Does anyone else have the same problem?
     
  20. chloelcdev

    chloelcdev

    Joined:
    Sep 19, 2021
    Posts:
    6
    I've sent an email as well but this asset seems to break down when using Rigidbody2D with gravity, is there a workaround for this? We use gravity for enemy blow-back.
     
  21. Joywayer

    Joywayer

    Joined:
    Feb 1, 2021
    Posts:
    5
    Hello, Tilemap bake problem,just part of platform bake success Unity_apf6nAzK03.png
     
  22. Joywayer

    Joywayer

    Joined:
    Feb 1, 2021
    Posts:
    5
    Another question,How can i get random goal on segment where player stand on
     
  23. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    I can't really say what it is based on that screenshot alone. Can you send me an example scene with the problem occurring? Either here in the thread or per email. Would help a lot.

    To move to a random section you can use this function:
    https://oribow.github.io/PathBerser...vAgent.html#aabb985b704548b27938bbdd234eacc3b
    To get a random section you can use this function: https://oribow.github.io/PathBerser...BWorld.html#af42419f602ef14eeabc56655a1d21f82 Although, keep in mind that this point may not be reachable from the player's current position or the player may not be able to stand on it, because the ceiling is too low. Look at the above NavAgent's random walk function for an example on how to use it despite these limitations.

    A different approach might be to generate a random point yourself and use https://oribow.github.io/PathBerser...BWorld.html#a4b98c59ae4be6beb58154844571cd87a to map it to a segment. Since that function takes in a NavAgent as parameter, the resulting point is guaranteed to be a valid position for the agent.
     
  24. Joywayer

    Joywayer

    Joined:
    Feb 1, 2021
    Posts:
    5
    Thanks for your reply.This is my example scene (Scenes/SampleScene).in project .
     

    Attached Files:

  25. Joywayer

    Joywayer

    Joined:
    Feb 1, 2021
    Posts:
    5
    How can i know about NavAgent can or not reach goal
     
    Last edited: Jun 8, 2023
  26. PathBerserker2dDev

    PathBerserker2dDev

    Joined:
    Jul 14, 2020
    Posts:
    44
    Thanks! I have taken a look at it and discovered somethings in the code that were not working as expected. I've fixed it up and just submitted an update to the store. It should be live in a few days.

    I'm adding a convenience function for it in the NavAgent class in this release. That's what it will look like:
    Code (CSharp):
    1. /// <summary>
    2. /// Convenience function that will return if the agent could reach the given point from it's current location. It runs synchronously which is not optimal for performance.
    3. /// </summary>
    4. public bool CanReach(Vector2 goal)
    5. {
    6.     var pr = CreatePathRequest(Position, goal);
    7.     PBWorld.PathTo(pr);
    8.  
    9.     while (pr.Status != PathRequest.RequestState.Finished && pr.Status != PathRequest.RequestState.Failed)
    10.     {
    11.         // fast spinning
    12.     }
    13.     return pr.Status == PathRequest.RequestState.Finished;
    14. }
     
  27. Joywayer

    Joywayer

    Joined:
    Feb 1, 2021
    Posts:
    5
    Thanks!