Search Unity

Polarith AI (Free/Pro) | Movement, Pathfinding, Steering

Discussion in 'Assets and Asset Store' started by Polarith, Apr 18, 2017.

  1. nerzoff

    nerzoff

    Joined:
    Jun 9, 2019
    Posts:
    9
  2. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes @stevenwanhk,

    As you can read in Frays publication (Steering Behaviours are doing it wrong), it is inspired by racing games, though it is applicable for a much bigger field. Herds and flocks are possible, though the classic approach by Reynolds is fine for this since small errors on individuals do not have a large influence on the overall perception of the flock. However, it is perfectly fine to combine those two since Polarith might steer some key individuals (leaders) or the overall flock direction. Of course, Polarith is capable of flocks, too, but it is more expensive than Reynolds. Depending on the number of individuals, Reynolds is preferable. As you stated correctly, some learning is needed depending on how deep you will dive into AI behaviour and combinations.
    It depends on what to do on the Navmesh. We provide NavMesh support (border perception) and navigation through external (e.g. Unitys) pathfinding. Polarith is fine to combine with pathfinding since pathfinding yields the overall direction and Polarith is doing the local avoidance.

    @Artini
    Polarith does not provide animation models. We offer a steering solution that will decide where your NPCs will move (locally). Animals are fine though since flee and hunting behaviours are easy to set up. Additionally, we provide components like AIMWander which is nice for idle state. I highly recommend reading our manual and watching the examples on YouTube.

    Have a great day,
    Martin 'Zetti' Zettwitz from Polarith.
     
  3. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Last edited: Jun 29, 2021
    nerzoff likes this.
  4. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    181
    Thanks for the answer. This AIMWander is probably something, I will start using from the beginning.
    Does anybody use Polarith with:
    https://assetstore.unity.com/packages/tools/game-toolkits/third-person-controller-126347
    This one has easy setup for NPCs and IK, that works well with my projects.
     
  5. nerzoff

    nerzoff

    Joined:
    Jun 9, 2019
    Posts:
    9
    hello again, I really like your asset, but I can't figure out how I can combine avoid and arrive? or rather, what scripts should I put on the object for them to work together?
     
  6. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @Artini,

    I am not familiar with this asset, but I assume it will 'only' do the actual movement and camera control? This should be fully compatible with our asset since we only compute the movement direction. The actual movement act is up to you. Note, our example controllers are really basic and should only serve as an example. Custom controllers that fit your needs are mandatory most of the time.
    In your case, I assume ThirdPersonController needs some input such as direction and movement speed. You can obtain this from Polarith AI from AIMContext. Have a look at our example controllers :) You can try the free version to create simple behaviours and integrate with the ThirdPersonController.

    Happy experimenting,
    Martin 'Zetti' Zettwitz from Polarith.
     
  7. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @nerzoff,

    They are not designed to have the same purpose. AIMArrive is designed to reduce the magnitude (that's why it is set to Subtraction) when arriving a specific target (Vector3). AIMAvoid is designed to create magnitudes parallel to a target object such that the agent actively moves around the obstacle. If you want to combine them for any purpose you may play around with the sensitivity offset, the magnitude multiplier, the plane bend, and so on.

    Greets,
    Martin 'Zetti' Zettwitz from Polarith.
     
    nerzoff likes this.
  8. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Any idea why `Context.DecidedDirection` gives y = 0?
    Points from AIMFollowWaypoints and AIMUnityPathFinding are correct as you can see
    The one in example scene "UnityPathfinding" gives y certain values so the context can climb up the slope
    Not sure why it happens
     

    Attached Files:

    • pic.jpg
      pic.jpg
      File size:
      325.2 KB
      Views:
      286
  9. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @stevenwanhk

    You are using an XZ-sensor, thus the decided direction is only inside the XZ-plane, which should be no problem in a 2.5D game. If your character is able to move in full 3D (as in space games), you need a spherical sensor.

    Have a great start into the week,
    Martin 'Zetti' Zettwitz from Polarith.
     
  10. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    67
    Question - Setting Environment in a prefab.

    In the video How to Move an AI Character - Part 1/3 | Polarith AI Unity Tutorial [Basics] you explain how to set up the AI from the level of the scene hierarchy.

    Obviously this is not the way we will create enemies - which usually are prefabs. As far as I understand the AIM Steering Perceiver component is general for all enemies. How do I assign it for the prefab enemy that I will spawn. Now I know that I can do it through my own custom script but what is the workflow for this in your framework?

    Later on in AIM Flee you select one of the environments:
    upload_2021-7-22_7-48-52.png

    Which obviously I don't have in my prefab because I don't have the Steering Perceiver assigned in the AIM Steering Filter on my prefab. Do I type the string name instead of the environment that I have created in the main hierarchy? Or do I also have to set this up through a custom script together with the assignment of the Steering Perceiver

    Edit - Putting the string in doesn't work.

    upload_2021-7-22_7-51-29.png

    I would really appreciate the help!
     
  11. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    67
    Does the AI Flee behaviour (or your AI system) work with tilemap 2D composite colliders? I have a collider surrounding a top down 2D island to prevent the Agents from exiting the walkable terrain - like an outline. Wił it work correctly?
     
  12. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @SunnyValleyStudio,

    1. There are multiple ways to do this. First, as you said correctly, you can use a script to assign the AIMSteeringPerceiver to the SteeringFilter. Second, you can use the ObjectTag property to look for a valid tag in the scene as written in our doc.
    2. I need to have a closer look at the code, usually, a string should work since the property is a List<string> as long as (1) is fulfilled.
    3. You need either AIMSteeringTag with a proper range on each tile (limited to circles), AIMFleeNavMesh, or AIMFleeBounds.

    Have a great Thursday,
    Martin 'Zetti' Zettwitz from Polarith.
     
    SunnyValleyStudio likes this.
  13. GameForger

    GameForger

    Joined:
    Feb 22, 2013
    Posts:
    2
    I'm trying to learn Polarith Ai Free and I'm getting werid behavoir in the Avoid 2D demo Scene.
    I can't make the Agent turn left to avoid the Danger. I moved the Danger2D Object down to Y= -0.5 and this happens.

    2D Avoid Scene error.gif
     
    Last edited: Jul 23, 2021
  14. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    67
    Hey Martin!

    The tag solution worked and I can use a string as a name of a Filtered Environment. I do need a detailed instruction on how to set up a flee behaviour for a bounded space using unitys standard 2d tilemap collider (2d composite collider):
    upload_2021-7-23_10-11-50.png

    I have used AIM Flee Bounds simply doesn't do anything and AIM Flee works only with non 2d tilemap colliders. I have tested it with a 2d box colldiers and the setup works. If I change the layer for the 2d colldier bounding box it works so the setup should be ok.
    upload_2021-7-23_10-33-8.png

    upload_2021-7-23_10-14-49.png

    This is a default Unity 2d composite collider with "Obstacle" layer that I have added to the Steering Perceiver.

    upload_2021-7-23_10-15-22.png

    I mean I know I can place additional 2d box colliders on the border of the collider but this seems like a hacky way.



    How do I set it up?

    Take care!
    Peter
     

    Attached Files:

    Last edited: Jul 23, 2021
  15. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    67
    Adding additional colliders works but it looks awful and it adds a lot more work for me - I mean instead of placing only the tiles and getting the colliders generated automatically through tilemap collider I have to manually generate those and adjust them for efficiency.
    upload_2021-7-23_10-43-31.png

    The Tilemap collider even non composite doesn't work.

    upload_2021-7-23_10-42-50.png
     
    Last edited: Jul 23, 2021
  16. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @GameForger,
    This is only a demoscene to show the overall behavior in this particular scene. The agent will move straight if you reduce the outer radius, the magnitude multiplier, or the value mapping. Note, you must adjust the params for your particular scene/game setup.

    Have a fresh start into the new week,
    Martin 'Zetti' Zettwitz from Polarith.
     
  17. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @SunnyValleyStudio,

    Sorry for the delay, we had our second vaccination at the end of last week and many developers got sick.
    The composite collider won't work for this purpose since you are inside the collider. Thus, the bounds check won't work. Additionally, you need to perceive at least the center of an object to check if it's in range and process the bounds (this is why it's hard using bounds on very large objects since the radius must grow large).
    Unfortunately, the tilemap, or its individual tiles, are not supported yet. I'll put it on the requested feature list.
    As a quick workaround, you can write a script that iterates over each tile of the tilemaps and either generate a box collider 2d or generate an empty (static) game object at the center (additionally with AIMSteeringTag and set radius fit to the tile size).
    Another, but more complex way, is to write a custom behavior that processes the tilemaps and handles the individual tiles.

    Sorry, I can't help more at the moment.
    Martin 'Zetti' Zettwitz from Polarith.
     
    Last edited: Jul 27, 2021
  18. Overlogical

    Overlogical

    Joined:
    Sep 12, 2020
    Posts:
    12
    Hi @Polarith,

    you wrote that the interfacing/integration of Aron A* Pathfinding project is on your bucket list. Any details when this will come to pass?

    Kind regards,

    Jan
     
  19. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hey @gerlachharz,

    we are currently working on releasing our formations add-on as open-source for Free and Pro users. After this, we will work on an open-source interfacing/integration of Aron A* Pathfinding. ETA is autumn this year.


    Regards,

    Martin Kirst
    Polarith CEO
     
  20. sfilo

    sfilo

    Joined:
    Oct 23, 2012
    Posts:
    30
    Hi @Polarith,

    I have a problem configuring AIM Seek with outer radius smaller than 20 for a 3D environment with a SpatialHigh sensor.
    I have really tried to figure it out and was unable.
    I can easily reproduce it in the the AircraftTown scene by following a few easy steps:
    1. Deactivate Aircraft Controller, Aircraft Physics and set rigidbody to kinematic for Agenr Aircraft to make it easy to move by hand
    2. Deactivate the "Aim Seek Don't hit ground" and the "Seek Ground" components ( so that the context indicator doesn't show it )
    3. Lower the outer radius on the "Aim Seek Don't hit buildings" component to less then 20
    4. Move the Agent Aircraft game object by hand so that the "Aim Seek Don't hit buildings" out radius indicator clearly tuches one of the buildings
    To my understanding, the context indicator should be showing red bars toward the intersected building, but it's not happening. If I set the out radius to more then 40 it starts working again.

    I need a smaller agent that could fit through narrower passages. Am I using it the wrong way?

    I uploaded a screenshot to show this. Am using an empty project with the Polarith pro 1.7.1 on Mac OS, unity 2019.4.18.f1.

    Kind regards,
    Stefan
     

    Attached Files:

  21. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @sfilo,

    The (bounds) behaviours are radius steering behaviours. Thus, they need to perceive the center of a game object to get the position (and the bounds information of its collider). For larger objects, either the radius must be bigger, or the objects must be subdivided into smaller parts.

    Have a great Friday,
    Martin 'Zetti' Zettwitz from Polarith.
     
    sfilo likes this.
  22. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315



    Hello, our dear community!
    It has been a long time since we released an update for Polarith AI. So, here we go:

    As a humble thank you for your continued loyalty, we have added 2D and 3D formations to Polarith AI Pro and Free. We hope that they will save you some of your valuable time. The source code of this extension is publicly available on GitHub. Besides the repository, you can directly download the Formation sources into your project with the help of installer scripts bundled in a ZIP archive within the latest Unity Asset Store packages.

    Thank you for understanding that we can only offer limited support for freely available open-source code. Feel free to commit your ideas to the public GitHub repository if you like.

    The next thing we will work on this year will be the official integration with the A* Pathfinding Project. Thank you all for your continuous support.


    v1.8 Open-Source Formations

    Changes
    • Changed visibility of some editor classes for compatibility with the Formation behaviours
    Enhancements
    • Formations are available as source code on GitHub
    • For convenience, you can use the download script in /Polarith/AI/Extensions
    Fixes
    • Changed flat circle gizmo in AIMSteeringFilter to spherical gizmo if a spherical sensor is attached


    We wish you a productive time and much fun using the new formation components.

    Martin Kirst
    Polarith CEO
     
    Last edited: Aug 23, 2021
    BCFEGAmes likes this.
  23. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Last edited: Oct 19, 2021
    Quique-Martinez and BCFEGAmes like this.
  24. skinnylizardstudios

    skinnylizardstudios

    Joined:
    Sep 24, 2021
    Posts:
    1
    Do you have a discord? there are a few times when I need instant help :p

    Thanks
     
  25. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @skinnylizardstudios,

    We do not have a Discord server, please use our official support form at the bottom of the page.

    Have a nice Monday!
    Martin 'Zetti' Zettwitz from Polarith.
     
  26. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    wow, only just saw this, can't believe I missed it! Looking forward to using formations!!!
     
    Polarith likes this.
  27. EntangledGames

    EntangledGames

    Joined:
    Mar 8, 2013
    Posts:
    9
    I think I didnt explain my problem properly, what is happening is that the NavMeshAgent is navigating offmesh links automatically.

    Example:


    In that video the red capsule has a NavMeshAgent with "AutoTraverseOffMeshLinks" set to false and a script that sets its destination to the player, so it moves towards the player and stops at the edge of the navmesh, without traversing across the Off Mesh Link.

    The blue capsule only has Polarith scripts, the screenshots uploaded will show this. That capsule moves towards the player but when it hits an OffMeshLink its NavMeshAgent teleports instantly across, even if "AutoTraverseOffMeshLinks" is set to false, I have made several test that lead me to believe this only happens when using AIMUnityPathfinding and AIMFollowWaypoints.

    Edit: After running some test I can see that the NavMeshAgent.isOnOffMeshLink never returns true, but the Polarith provided delegate OffMeshLinkReached works just fine, so I think that with that I can make this work even if the NavMeshAgent component teleports instantly to the end of the OffMeshLink. But still I would like to know if this instant teleportation is indeed being caused by AIMUnityPathfinding.

    Edit #2: Its seems the OffMeshLinkReached delegate is not working well after all, the OffMeshLinkData always returns null, so it can recognize that it reached an OffMeshLink/NavMeshLink but it can't tell me its properties, sure there are other methods to get that info but it would be nice if the delegate worked, maybe im missing something
     

    Attached Files:

    Last edited: Oct 12, 2021
  28. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @EntangledGames,

    Sorry for the long delay, we have been busy with preparations for an international conference. I had a look inside the code and indeed, it seems Polarith teleports the agent by calling
    NavMeshAgent.CompleteOffMeshLink()
    if
    NavMeshAgent.isOnOffMeshLink
    . Afterward, the delegate is called.

    So here I want to ask for your help. Can you please provide your or a simplified demo scene via e-mail to support@polarith.com? Additionally, I want to discuss the behaviour you guys would expect since we are no game developers and we must match the needs of the AI with the needs of the designers.

    Looking forward for productive talk,
    Martin 'Zetti' Zettwitz from Polarith.
     
  29. airop

    airop

    Joined:
    Sep 4, 2012
    Posts:
    34
    Hi, we are currently trying to setup a air unit system so we have jets that take off and land and can fly and behave naturally while doing so. we are currently using a* pathfinder pro and we are wondering when the integration will happen so we can start using this tool
     
  30. Peter_Wackomeida

    Peter_Wackomeida

    Joined:
    Nov 17, 2016
    Posts:
    15
    I got the pro version and I like what I'm seeing, but I'm afraid even the manual is a little too complex to me.

    I'm looking for a spaceship to be at rest most of the time then go to a destination and stop again until given a new one. This is for a point and click adventure game where you fly to other ships then ask them questions, scan, ect.

    As far as I can tell none of the example scenes have this feature. I tried to add "arrive" to the 3D space ship demo but no go. I'm sure this is my own lack of experience but some guidance would be great.
     
  31. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hey @airop, I'm not sure whether we manage to code and document a decent A* Project integration this year because we have other running projects for earning the relevant money for our company. But, all in all, it shouldn't be so hard. If you want, you can write us a mail at support@polarith.com, then I will give you access to the sources of our Unity Pathfinding integration. Since we use a lot of generic classes, it should be fairly easy to derive from our base classes and exchange Unity's waypoints with A* waypoints.


    Best regards,

    Martin Kirst
    Polarith CEO
     
  32. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hey @Peter_Futurus,

    try to achieve the desired behavior with as few components as possible. Also consider a simple state machine for your agents. This state machine can then enable/disable AI components or character controllers as required.

    In your case, when the state machine says 'Okay, let's go to this point over there', then activate a correctly configured AIMSeek respectively the corresponding controller of the agent, making it move.

    If you need further help, write us at support@polarith.com. One of my colleagues will help you out.


    Best regards,

    Martin Kirst
    Polarith CEO
     
  33. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi there, This looks a really interesting asset. I just wondered in its current state if its functional enough to be applied as an AI for animals. Is it workable to get animals to find food, create shelter based on their stat needs? It seems like follow a player, avoid an enemy is there but i just wondered about these extra decisions?
     
  34. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @AndNeoman,

    You have to distinguish between high level logic and low level logic. Finding food breaks down to walk/wander and seek, same for creating a shelter (like gathering twigs etc). You can control this by a state machine. Each state might activate specific behaviour components and set its parameters.
    In general, we provide a movement AI (thus e.g. avoid and follow) - The reasoning behind this movement is up to you.
    You can try some of your basic ideas with our free version and see if it fits your needs.

    Enjoy your Thursday,
    Martin 'Zetti' Zettwitz from Polarith
     
  35. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks for the prompt reply. I have bought the Pro pack and already have decision trees designed for the actions of collecting food etc with another AI package but wondered how I would port them across to Polarith. As you say it is mostly directing the animal to an item of interest etc as you can see I'm really new to your asset and wondered how I would link it in with my animal controller if there was any pointers to get me in the right direction that would be excellent. It looks a really interesting implementation btw.
     
  36. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @AndyNeoman,

    In general, you need to link the components to your code (e.g. public properties/attributes, or by component search). Then, you can enable/disable specific behaviour components of our AI.
    Some behaviours might be used across multiple high-level states in your decision tree. In this case, you can either set up multiple behaviours with different parameters and enable/disable the one you need, or you change the parameters on runtime based on your needs for the specific state.

    Have a great Friday,
    Martin 'Zetti' Zettwitz from Polarith.
     
    AndyNeoman likes this.
  37. jmacgill

    jmacgill

    Joined:
    Jun 17, 2014
    Posts:
    17
    Any chance of a 3D variant of Orbit? - existing one works but is limited to one of the 3 planes.
     
  38. jmacgill

    jmacgill

    Joined:
    Jun 17, 2014
    Posts:
    17
    Actually - made my own behavior that seems to work (learned a ton about quaternions along the way).

    Thanks for open sourcing the formations extension - very valuable learning resource!

     
  39. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @jmacgill,

    I am glad you made it! If you like you can share your code in our Github public repo. If interested, send me an email at support@polarith.com so I can add you to the repo.

    Have a great day,
    Martin 'Zetti' Zettwitz from Polarith.
     
  40. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    Hello @Polarith

    I am currently working on an arcade~y 3D space dogfighter (think Freelancer, Chorus etc.) and making my way through my AI/steering/sensor assets in order to decide on the asset to use for interesting enemy movements. (I've gotten pretty far into my own solution but I've hit a roadblock).
    Your asset is currently at the top of my list because it was really easy to setup and strikes the perfect middleground between usability, modularity and variability.

    However, I feel like I'm doing something wrong. I have a very nice test case set up where the AI agents try to follow a dollycart on a track through my test level set up with greyboxed obstacles. The interesting thing about those obstacles is their elongated height and their cube-based difficult angles. When agents follow the cart flying along the height of those obstacles, most reach an edge-case very quickly. Yours does as well but I think it's because I'm not using the behaviours correctly.

    Here are three gifs to illustrate the problems: (hope these work)
    PolarithTest-0001.gif PolarithTest-0002.gif PolarithTest-0003.gif

    And this is the main part of the setup for the agent:
    upload_2022-3-23_22-28-47.png

    I want to move towards "Interest" (the cart), while avoiding "Danger" (the obstacles).

    The Rigidbody is moved by setting the velocity to the AimContext's DecidedDirection multiplied by a maxSpeed parameter. It's the most basic movement you could think of serves mainly debugging and testing purposes.

    Question: Am I working against natural limitations of your asset here or have I bungled some settings? o_O
     
  41. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    I think the problem is with the elongated shapes, as avoid uses the trasform position, try with avoid bounds, and if you are going to get more complex shapes, look at the "avoid ground" script, which uses a raycast to spawn an empty game object on terrain and sets it as target to avoid, and work from there. I worked with a solution provided by Martin that uses the 3D sensor as a scaffolding for multiple ray-casts and have agents successfully navigating a convex cave system...
     
  42. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    Thank you for the advice. That sounds very interesting and I definitely haven't exhausted this asset's options yet. I'll experiment some more. :)

    EDIT:
    Alright, I've played around with AIM Pursue and AIM Planar Avoid Bounds because those basically model the two behaviors I'm looking for exactly. (pursue a target while avoiding obstacles)
    upload_2022-3-24_13-45-54.png upload_2022-3-24_13-46-8.png

    I've gotten a few good results by:
    • changing the constraints of the environment in the context after reading up on them again (specifically, removing the Min check for Danger
      upload_2022-3-24_13-44-44.png
    • adjusting how the controller sets the velocity. (It looks much more spaceship~y than before.)
      upload_2022-3-24_13-42-34.png
    • using AIM Retention for what I think is a bit more smoothing for the obstacle avoidance
    BUT now I have run into a weird resulting behavior where the agent semi-successfully avoids the obstacle angle he is flying towards in the beginning (not perfect yet), but at some point decides to fly off into empty space, only to return on the pursuit and then fly directly into an obstacle without any avoiding corrections.

    It just looks weird to me and I both wanted to chronicle it for myself and ask here what else I can do to help the agent reduce its velocity when close to an obstacle.

    PolarithTest-0004.gif
     
    Last edited: Mar 24, 2022
  43. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @paulindrome,

    First of all, you should use AIMContextIndicator instead of the Gizmos, at least for 3d spatial sensors. The flickering will be removed if you do not select the AI component while you are in the editor.

    To your actual question. As @Skorcho said, AIMAvoid uses only the Transform.Position. Hence, the object is perceived as a point. To perceive the object's shape, you need to use bounds behaviours, such as AIMAvoidBounds. Note, that the objects transform.Position must be inside the radius as well, otherwise, the behaviour cannot perceive the object. Keeping this in mind, it might get hard to perceive objects with long shapes. Additionally, the bounds are bounding boxes, meaning, the object is perceived as a quad. For better perception, you can follow the advice from @Skorcho working with an altered version of SeekGround. You can see an example of the basic script in the 3d airplane scene in our package. Note that raycasts are computationally expensive, so don't use them too much.
    Another option would use AIMAvoid together with AIMSteeringTag and a certain radius on (empty) gameobejcts that are placed along with the obstacle to approximate the shape. The AIMSteeringTag with a set radius will work like small objects that offset the behaviour.

    Have a great day and happy exploring,
    Martin 'Zetti' Zettwitz from Polarith.
     
  44. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    @paulindrome

    One more thing: AIMAvoid is designed as active avoidance. Hence, it should target the objective interest since it will create values pointing to the desired movement direction. For passive avoidance, you may want to use AIMSeek(Bounds) and set the target objective to danger. This way, objects will create danger values such that the AI will reject the linked directions while looking for the target direction (which maximizes interest).

    Cheers,
    Martin 'Zetti' Zettwitz from Polarith.
     
  45. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    @Polarith Thank you for the insight and advice. I'll try that out. It just seemed counterintuitive to me to have an agent "seek" danger instead of "avoiding" it. I understand the constraint settings in the context a bit better now.

    I have edited my response to @Skorcho above with newer results because I didn't want to create another reply. Please check it out and let me know if there is any other advice you might have for me. Thank you!
     
  46. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @paulindrome,
    If not already done, have a look at our quickstart guide/manual and YouTube tutorials.
    You are using AIMAvoidPlanarBounds, which is designed for 2d sensors. It won't work properly in a full 3d environment. Therefore, use AIMAvoidBounds.
    To reduce the speed, you need to use a controller that makes use of the context.decided.value[0] (in case 0 is interest, .i.e. your first objective). Simply scale the movement velocity by this value, or have a look at our example controllers that use 'objective as speed'. Additionally, the property 'Prediction' may help you since the AI will behave like it is a few moments in the future.

    Cheers,
    Martin 'Zetti' Zettwitz from Polarith.
     
    Last edited: Mar 24, 2022
    paulindrome likes this.
  47. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    @Polarith Hey. Just wanted to get back to you with good news. Indeed with only using Pursue (interest) and Seek (danger) the agent only had 3 collision in about 30 minutes letting it roam free in my test area trying to follow the target. Thank you. The asset really works perfectly once you get the hang of it.

    Is it correct that the agent continues moving towards the target's last known location after losing sight of it?
     
  48. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @paulindrome,

    I am happy to hear you like our product, and you managed to get it working quite fast :) Indeed, it's most of the time the best way to keep it as simple as possible. If you are happy with us, we would love to see a review of you in the asset store :)

    This depends on the setup. Effects like history blending of AIMRetention leads to effects that even smallest values (of the past) yield a movement direction. To prevent this, you can adjust your controller such that a minimum value is necessary to move the agent.

    Have a great weekend,
    Martin 'Zetti' Zettwitz from Polarith.
     
    Last edited: Apr 5, 2022
  49. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    238
    Really like the look of your product and great job on the video tutorials, very well done.

    A quick scenario question, to make sure your solution is a good fit for an upcoming project:

    - I want to set up world with various AI agents and a single player character
    - The AI agents should freely roam around the world, stopping from time to time to show interest in static objects or other AI agents
    - Agents would have one of a handful of basics "behaviour profiles" : curious, timid, friendly, etc
    - The above happens as a simulation regardless of the player character
    - When the player character nears an AI agent, the agent responds according to their behaviour profile PLUS the addition of the player as a "Interest-Danger" point.
    - As the player gets closer to the AI agent, I'd like the actions of the player to dynamically increase the player characters "Danger" or "Interest" value.
    - If the player takes actions that increase "Danger" then they can, for instance, scare away an AI agent, moving to a "Hide" location
    - If they take actions that increase "Interest" they can befriend the AI agent, perhaps causing it to follow the player

    I haven't seen a concrete example of this kind of prey - predator - friend relationship, but it seems doable given the systems discussed in the tutorial video.

    So a few questions:

    - Is this indeed doable?
    - Is the right way to think about this as having a set of static points of interest and then the player as a fluid Interest-Danger element?
    - How can I model a single element, the player, as having a dynamic value from Danger to Interest? What is the right way to model this? Is there a way to store a single value for -1 (danger) to 1 (interest)?

    Thanks in advance!
     
  50. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @v2-Ton-Studios,

    1. Your scenario sounds like a good fit for our AI. In general, you can set up different prefabs for the agent profiles, or you can set them using a state machine where particular behaviours are de-/activated.
    The response to the player with respect to the distance is set up easy by our so-called Radius Steering Behaviours (like AIMSeek or AIMFlee), where the interest/danger value is increased based on the distance to the target.
    The 'moving to a hide location' might use a pathfinding solution (as Unity's inbuilt method), that is compatible with our system (but don't worry, some guys in the forum managed to implement custom solutions to different pathfinding solutions they used).

    2. This depends on what you mean by static points of interest. Static points (to our AI system) are e.g. obstacles while dynamic points are everything else that can change its position (like the agents and the player or some moving obstacles). If you think of static points of interest as a mental model to distinguish between the agents and the player you are right, but I would stick to the meanings of our system ;)

    3. Objectives are not values that vary in a range of [-1, 1] but separate values, functions respectively. As shown in our manual, interest and danger are dealt as two independent functions. While interest should be maximized, danger should be minimized. Therefore we use multi-criteria-optimization to find the best solution that maximizes interest while being above a threshold of danger ('what is my best option for getting the most benefit without getting hurt'). Our system yields exactly this movement solution so you usually don't have to deal with a single value. If you want to store it in a single value you might subtract the danger value of the decided receptor from the interest value of the decided receptor, but right now I don't see a point why to do so (since it's already a valid solution).

    P.S. you can validate most of the things above with our free version :)

    Have a great start into the new week,
    Martin 'Zetti' Zettwitz from Polarith.