Moving NavMesh Platforms! YES You CAN (mostly)! AI Series Part 28 | Unity Tutorial

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии • 54

  • @burningthumb
    @burningthumb 2 года назад +2

    At 6:54 in the video you add the distance traveled to distance instead of to distanceTraveled so the platform never stops moving in the direction of the first point. A small bug but an important one.

    • @LlamAcademy
      @LlamAcademy  2 года назад +1

      Wow! Thank you for catching that and calling it out! That is a very important one.
      I double checked the GitHub repository and it looks like this was an error in the video, but in the repository it is correctly incrementing distanceTraveled. Anyone following along will need to be warned of this, and anyone who is copying scripts from GitHub will have it working correctly.

  • @mynameispatrickandiliveund7628
    @mynameispatrickandiliveund7628 2 года назад +4

    This is actually epic, imagine seeing Unity saying that this is not supported and then you make it happen and the limitations are also not really that big of a deal.
    Great job honestly.

    • @LlamAcademy
      @LlamAcademy  2 года назад +1

      Thank you! I was really surprised to find that you could achieve this with relative ease! The drawbacks...depending on your game type may be a deal breaker but there are lots of use cases that they are really inconsequential

  • @TechLevelGames
    @TechLevelGames 2 года назад +1

    Oh God! I am cant belive that there are this way! I am try implement this in my game. Subscribed!)

  • @fysyty
    @fysyty 9 месяцев назад +1

    Hi I tried to apply this to a moving elevator, but when I update the surface position some agents get stuck mid air, the surface update happen every frame but the agent update don’t(asynchronous), can it be the reason why they lose the surface position ?

  • @haarissheikh3187
    @haarissheikh3187 2 года назад +1

    Hi. Thank you for this tutorial but where did you get the 'NavMesh Surface' component because it’s not showing up on my unity? Thank you

    • @LlamAcademy
      @LlamAcademy  2 года назад +1

      Hi! You need to use the NavMesh Components (github.com/Unity-Technologies/NavMeshComponents) to get the NavMeshSurface. In the first video of the AI series I go over how to install it: ruclips.net/video/aHFSDcEQuzQ/видео.html

  • @poobagification
    @poobagification 3 года назад +4

    Unity docs: you can't do that!
    Llama man: hold my beer and watch this.

  • @KiZhuGames
    @KiZhuGames Год назад

    Enabale and dilsable agent it good idea to swap betwen navMeshes. Thanks

  • @BadMouseRM
    @BadMouseRM 2 года назад +1

    Hi, great videos!
    What if you want to move to a normalized speed from one platform to another ? I mean avoid to move in a higher speed when pass thro the NavMeshLink ? Thanks!

    • @LlamAcademy
      @LlamAcademy  2 года назад

      Good question! I've covered NavMeshLink traversal on a couple of other videos. The simple one was: ruclips.net/video/dpJUc_BpChw/видео.html (AI Series Part 2) and a more advanced one here: ruclips.net/video/PD6VFD1a21g/видео.html (AI Series Part 17).
      To shortly answer your question - you have full control over the agent while it traverses the NavMeshLink. You can calculate the distance they'll travel from the start/end points and move them over that distance using the Agent's current velocity, or target speed.

  • @KENISEG
    @KENISEG Год назад +1

    uhm........ I dont have "Collect Objects" in my NavMeshSurface component. Unity ver.2022.2.21f

    • @LlamAcademy
      @LlamAcademy  Год назад

      🤔docs.unity3d.com/Packages/com.unity.ai.navigation@1.1/api/Unity.AI.Navigation.NavMeshSurface.html#Unity_AI_Navigation_NavMeshSurface_collectObjects
      It seems like it should be there. This has always been an option on the Surface. Can you maybe reinstall your Navigation Components and see maybe something went wrong in the installation?

    • @jedoncarter8570
      @jedoncarter8570 6 месяцев назад

      How did you get navmesh surface script in 2022? It doesn't pop up for me

    • @LlamAcademy
      @LlamAcademy  6 месяцев назад

      You have to install the navigation package from the package manager

  • @dustypants9326
    @dustypants9326 3 года назад +1

    Moving platforms are fun. Have you tried rotating platforms?

    • @LlamAcademy
      @LlamAcademy  3 года назад

      I have not. I imagine you'd do the exact same thing, but instead of updating the destination every frame, you would update the Agent's local rotation every frame by the same amount as the platform is rotating.
      I'll take a look and see if it's that simple and get back to you.

    • @dustypants9326
      @dustypants9326 3 года назад +1

      @@LlamAcademy kinda, you still have to move the player/agent.
      Say like a short and wide column that is rotating; The rotation and distance of the column has to be translated to the player's position and rotation.

    • @LlamAcademy
      @LlamAcademy  3 года назад +2

      True. I'll let you know, possibly with a follow up video

    • @danielcrandall2033
      @danielcrandall2033 3 года назад +1

      @@LlamAcademy has this been addressed?

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      @@danielcrandall2033 don't tell anyone, but that's next week's video 😉

  • @RadRichAntics
    @RadRichAntics 2 года назад +1

    How could this work when teleporting an entire navmeshsurface? Is it possible to do so without rebuilding that navmeshaurface and simply warp the ai?

    • @LlamAcademy
      @LlamAcademy  2 года назад

      Hmm... I think rebuilding the NavMesh would be the safest option for that.
      Depending on how far you're "Teleporting" you could just have 2 instances of whatever your player is on and have the teleport just warp the player between the two.

  • @thrazamund7062
    @thrazamund7062 2 года назад +1

    Thanks for this. Would this be applicable to platforms that just move up and down? Or is a different way recommended?

    • @LlamAcademy
      @LlamAcademy  2 года назад

      Great question! As long as the platforms don’t move too quickly I see no reason they won’t work for up/down movement as well. I haven’t tried that myself yet but based on how it works, I don’t expect any issues with that

    • @thrazamund7062
      @thrazamund7062 2 года назад +1

      @@LlamAcademy Ok, great! I will give it a shot. I see that you’re covering a ton of super useful topics(enemy surround, ai door behavior, hitscan tracers etc.) Can’t wait to dig into them. Subscribed!

  • @Endar0
    @Endar0 3 года назад +1

    Good tutorial!

  • @ludwig9601
    @ludwig9601 3 года назад +1

    Would you say it is possible to use off-mesh links when navigating using joystick/wasd movement?

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      I'm not entirely sure. I would not try to mix the NavMesh with Joystick / WASD movement. Instead, I would control it with a Character Controller or Rigidbody Controller and implement a jump. Any "Enemies" could be on a NavMesh to chase the player. That's how I implemented it on Llama Survival at least - the player runs around on the level with a Character Controller and all the zombies use the NavMesh with some NavMeshLinks to jump over gaps / obstacles.

  • @elric7371
    @elric7371 3 года назад +1

    Really good series.Is it possible to make it so that when enemies spawn the kind of roam around the spawn area?

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      Yes! That's covered in AI Series Part 11 ruclips.net/video/3hXkdARwREo/видео.html

    • @elric7371
      @elric7371 3 года назад +1

      @@LlamAcademy Thank you ,much appreciated.

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      You're welcome!

  • @psybergames7327
    @psybergames7327 3 года назад +1

    Need to test it but could just when the agent goes onto the platform child the agent with the platform. Think potentially solve alot of the other limitations as the agent could you the local position then to move around on the platform movement speed would remain relevant because of be a child of the other agent I may be not calculating for something but I am positive that will work. Let me know if you try it and it does be interested to see. Awesome video too big ups.

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      I'll definitely try it out alongside the rotating platform to see how it goes! Thanks for the idea!

    • @psybergames7327
      @psybergames7327 3 года назад +1

      @@LlamAcademy very welcome came to channel needing prototype quick AI for game releasing at pocket gamer connect 8. So thank you for the content.

    • @psybergames7327
      @psybergames7327 3 года назад +1

      I dropped you an email hope I addressed it correctly.

  • @INeatFreak
    @INeatFreak 3 года назад +1

    You could've cache the amount moved so it's a bit faster and easier to understand.
    while (distanceTraveled < distance)
    {
    var movement = platformMoveDirection * MoveSpeed;
    transform.position += movement;
    distanceTraveled += platformMoveDirection.magnitude * MoveSpeed;
    for (int i = 0; i < AgentsOnPlatform.Count; i++)
    {
    AgentsOnPlatform[i].destination += movement;
    // for always aligned agents to platforms, you can use this but it will not allow the Agent to move while the platform is moving
    //AgentsOnPlatform[i].Warp(AgentsOnPlatform[i].transform.position + movement);
    }
    yield return null;
    }

  • @ronigleydsonvilasnovas8067
    @ronigleydsonvilasnovas8067 3 года назад +2

    I arrived a little late this time, but I couldn't miss a video from the AI ​​series. A question, is it possible to make Unit NavMeshAgents navigate through more complex 3d meshes like trees for example?

    • @LlamAcademy
      @LlamAcademy  3 года назад +1

      I think so. I haven't actually tried it but I imagine because NavMeshes relatively planar... if you have a tree, the way I would approach that is to have a 90 degree rotated NavMesh to have the Agent be able to walk up the trunk, then another horizontal NavMesh from the branches you'd like the Agent to walk on. Connect these with some NavMeshLinks and it could probably work.
      That's a good one for me to experiment with though! Thanks for the idea!

    • @ronigleydsonvilasnovas8067
      @ronigleydsonvilasnovas8067 3 года назад +1

      thanks for the help and tips, until then i thought it was impossible to do this in Unity, even when i created a gigantic tree the result was not interesting.

  • @locusruizlopez5997
    @locusruizlopez5997 3 года назад +1

    amazing

    • @LlamAcademy
      @LlamAcademy  3 года назад

      Thank you! This one was a fun one for sure.

  • @dejavu2406
    @dejavu2406 3 года назад +1

    WTB llamacademy shirt. ty

    • @LlamAcademy
      @LlamAcademy  3 года назад

      I'll see how I can make that a reality!

  • @rendered3090
    @rendered3090 3 года назад +1

    Yay

    • @LlamAcademy
      @LlamAcademy  3 года назад

      That was my reaction too! 😁

  • @user-js7ud9du2y
    @user-js7ud9du2y 2 года назад

    sad that unity can't have true moving platform