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

Question A* Pathfinding Project in a platformer with gravity

Discussion in '2D' started by santiagoblas, Jul 1, 2023.

  1. santiagoblas

    santiagoblas

    Joined:
    Jul 23, 2022
    Posts:
    7
    Hello!

    I have this really simple game with platforms and willing to make an AI for climbing those platforms. The thing is: A* Pathfinding takes it automatically as a cenital view game, which is not the case, so it provides a path that does not care about gravity and, instead of making the character "climb", the path goes straight up and only if a collision occures it changes.

    I've read that there is a way to tweak the cost of going to certains nodes, but so far I've not been able to find how this is done.

    In this particular case I have to add that there are multiple "types" of character and they will aproach the climb in different ways.

    My intuitive aproach would be to make smallers paths between self made nodes (game objects) and let the A* pathfinding drive the character between this nodes one at a time, with my own logic to find the greater path, this seems odd cause I think A* is pretty powerful to do it on its own.

    Green is A* Path, blue is grid, ignore every other gizmo (the green one that starts on the ball and goes up is not from A*). This path is done with 4 connections nodes to better illustrate the problem

    btc.png

    I obviusly don't expect anyone to investigate, but to make it clear, this is A* https://arongranberg.com/astar

    Thank you!

    (I know this is pretty specific, I don't want anyone to give me a class on how specific this is like they've done in here https://forum.unity.com/threads/a-pathfinding-in-2d-platformer-with-changing-tilemap.786719/ It's just anoying)
     
    Last edited: Jul 1, 2023
  2. santiagoblas

    santiagoblas

    Joined:
    Jul 23, 2022
    Posts:
    7
    CLOSED!!!

    The developer made it clear to me that this package does not support platformer pathfinding.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    Platforming pathfinding is usually a bit more specialized, as you are finding out.

    It is obviously intimately tied to the abilities of the agent: can it safely fall off a cliff? Can it jump? How high can it jump? Can it change course mid-air (air steer)? etc.
     
  4. Kreshi

    Kreshi

    Joined:
    Jan 12, 2015
    Posts:
    433
    SeerSucker69 likes this.