Search Unity

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

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

  1. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes,
    Indeed, this would be a problem. You can avoid this by duplicating the whole AI game object and use our multi-selection editing. This way, you can edit both components in different game objects. Note that the correct AIMContext must be assigned to the controller.

    Good vibes,
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  2. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    406
    Hi Polarith! I’m currently using Behaviour designer which I like, but their included behaviours doesn’t (as far as I know) include and steering based on thrust/rotation but instead using just normal pathfinding.

    Could/should I combine your AI with Behavior designer to make your AI do the movement based on behaviours in BD, or does Polarith replace BD for AI behaviours?

    thanks!
     
  3. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    406
    After reading the docs and a lot in this thread I’m starting to think that I can still use behaviour designer, and use that to switch between different AIM setups.

    Do you have any example of FSM or similar, for example Attack until health is below 30%, then change to flee?

    How do I even set it up, do i use multiple child gameobjects with different AIM setups and is there a master controller that i can change which to use?

    I will try the actual asset later but I’m trying to figure out as much as possible beforehand :)

    would be very interesting to hear someone that has used Behaviour Designer with this asset.

    Thanks!
     
  4. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    Hi, there's an example in the free asset, the roundabout one, that uses the animator FSM to activate/deactivated AIM behaviours. I've used behaviour designer years ago, never with Polarith, but the possibilities are vast, you would obviously have to link "sensing" of things like health values, or even raycasting for tagged objects yourself, but the range of parameters to manipulate is really mind boggling. From changing the radius of steering behaviours, to their magnitude, to fully switching different sets on and off. If you wanted to push to "advanced" mode, you could even tweak individual parameters within a behaviour, like mapping or sensitivity offset, and create a sensor that perceives all around, and then focuses the steering once a target is defined, wish I had more time to experiment!!!
     
    nicmarxp likes this.
  5. Polarith

    Polarith

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

    Even though I have no experience with Behaviour Designer, it is possible to use our AI with FSM. I had written some (unpublished) scripts to control the states based on health, and radii (similar to your setup). You don't need different child objects, even though it is possible. Instead, you can attach several behaviours to a single AI object and activate/deactivate them based on the states. As @BCFEGAmes has written, you can also change the individual properties of our behaviours. In my script, I have activated and deactivated behaviours like seek/flee, and changed their properties, e.g., the radii or magnitude multiplier.
    You are welcome to experiment with our free version. I would be happy if you can share your experience with BD and Polarith in this thread afterwards :)

    Have fun while exploring,
    Martin 'Zetti' Zettwitz from Polarith.
     
    ludolamezia likes this.
  6. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    406
    Thank you @Polarith and @BCFEGAmes both. I will do some experimenting, but it’s further down the development of our gamed, but AI is something I’m looking forward to working with so I watch Polarith in the meantime :)
     
  7. Bazzajunior

    Bazzajunior

    Joined:
    May 23, 2015
    Posts:
    20
    I'm experimenting with the free AI version at the moment and even out of the box, it's working brilliantly. What's been great is that my concept game relies heavily on physics (think of a mix between a destruction derby and a timed single player survival) and a pathfinding or navmesh solution relies on translate rather than an add force movement. The only thing I'm struggling with at the moment is how to make sure that vehicles don't get stuck against a wall or each other.

    @Polarith - is there a way for an AI physics based vehicle to check it's forward momentum and if it's stuck, the AI can try and reverse to free itself from its predicament.

    I did see that this was touched upon in an earlier post but I couldn't see quite how to implement a solution.

    Any help or advice would be greatly appreciated :D

    Barry
     
  8. Polarith

    Polarith

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

    Great to hear that you love our product! The source code of our vehicle controller is accessible in the package. You need to add some lines where the inputSteeringAngle and the inputAcceleration are computed. If the decided direction faces backwards (angle between forward and decided direction exceeds a threshold) the inputAcceleration must be negative. Additionally, you need to trigger the car to move backwards by using a trigger/collider script.
    Even simpler with native components from our system, you can add a behaviour like AIMFlee with a small radius and a high magnitude multiplier. This way, the magnitude, the decided direction, respectively, will face backwards.
    Once, I've expanded the vehicle controller for a rudimentary simulation project. Maybe the following lines will help you. Just add them right before vehiclePhysics.Move() is called in FixedUpdate(). You might add more lines of code until it fits your needs. Note that we don't provide support for non-official code/scripts.
    Code (CSharp):
    1.  
    2. // Fields =============
    3. private bool reverse = false;
    4. //---------------------------
    5. private void FixedUpdate()
    6. {
    7. ...
    8.    float diffAngleDirection = Vector3.SignedAngle(
    9.       transform.forward.normalized,   AimContext.DecidedDirection, Vector3.up);
    10.  
    11.    // Check if already driving backwards for smoother movement
    12.    float thresh = reverse ? 75f : 110f;
    13.  
    14.    // Set the acceleration to negative value for backwards movement
    15.    // Clamp steering angle for sharp turns
    16.    if (Mathf.Abs(diffAngleDirection) > thresh)
    17.    {
    18.       reverse = true;
    19.       inputAcceleration = -1;
    20.       inputSteeringAngle = Mathf.Sign(diffAngleDirection) > 0 ? -1 : 1;
    21.    }
    22.    else
    23.    {
    24.       reverse = false;
    25.    }
    26. }
    Happy steering,
    Martin 'Zetti' Zettwitz from Polarith
     
    Bazzajunior likes this.
  9. Bazzajunior

    Bazzajunior

    Joined:
    May 23, 2015
    Posts:
    20
    @Polarith - this is amazing!

    Thanks for such a comprehensive response. I've implemented this and it now looks great :D
    The cars are not getting stuck against each other anymore. There's a few tweaks needing to be made but 'out of the box' it's all looking good. I'll post an update on Twitter (@molbergames) with a quick snippet of video.
     
    Last edited: Mar 9, 2020
  10. Polarith

    Polarith

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

    You 're welcome :) We are happy if little tweaks help you to get the most of our AI and we are excited about the progress of your development on Twitter.

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

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    Been a little while since this asset has been updated. Just checking, is it still being worked on?
     
  12. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hey there! Of course, we are not as active as at the beginning since, for a pure context steering plugin, we consider Polarith AI as feature-complete enough. Nevertheless, we will not abandon the development of Polarith AI in the future. We already prepared a bugfix patch that gets rid of many issues collected by our users so far.

    At the moment, we also think about releasing a new additional (low-cost) plugin for adding formations (as known from RTS games). However, these days our company generates most of its money from projects in the automation and artificial intelligence industry. But Polarith AI will always be in our hearts and based on the latest sales and income we can generate with Polarith AI, we are convinced that we could hire a full-time developer only for that plugin during the next months. Then, activity and new significant features should increase again.

    Thank you all for your support.


    Martin Kirst
    Polarith CEO
     
    BCFEGAmes, C_p_H, Novack and 3 others like this.
  13. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    Thanks.

    I wanted to make sure it wasn't on track to being abandoned before I bought it. I appreciate you guys keeping an eye on the project.
     
    Polarith likes this.
  14. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Hi Martin, any ETA for this? I'm using Polarith Pro in an upcoming project and I wonder if I'm unknowingly affected any of those bugs :)
     
  15. MrJBRPG

    MrJBRPG

    Joined:
    Nov 22, 2015
    Posts:
    40
    I have been playing around with the Polarith Library again after a long time not using it, and in the mood to experiment.

    I want to create a small prototype of going through the maze with interest, danger and solids.

    Before testing further, I am going with interest and danger as first baby steps.

    Default test settings for vessel with AIM Physics Controller 2D
    Seek - Interest
    Seek - Danger

    All collisions are circles for test

    I noticed the following behavior with and without collision:

    Without collision, they will sail through
    With collision, they will be stopped until they avoid the danger object

    I have three agents with 3 measurements of magnitude for seek danger:
    1. danger mag = 0.5
    2. danger mag = 1
    3. danger mag = 2
    When playing them, the higher magnitude on danger than seek interest will better avoid danger spots

    When doing another layout test with two dangers at the same axis as the interest, the vessels do avoid the first two, but they spin around the two danger spots when the interest spot is clearly the goal.

    I want to find a way, with either AIM Simple or Physics Controller, how to make the vessel avoid the danger spots in the same straight line as the interest spot.

    Any tip would be appreciated.
     
  16. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    @PixelEnvision,

    We are planning the release for June since our big projects have some crunch time in May.
    As a small appetizer, here is the provisional changelog:
    • [Pro] Added 'Objective As Speed' to the Aircraft Controller
    • [Pro] Fixed magnitude scalability for the Aircraft Controller
    • [Pro] Added 'Objective As Speed' to the Copter Controller
    • [Pro] Fixed magnitude scalability for the Copter Controller
    • [Pro] Added 'Objective As Speed' to the Spaceship Controller
    • [Pro] Fixed magnitude scalability for the Spaceship Controller
    • [Pro] Improved edge detection for distance validators in AIMPathfindnig
    • [Free/Pro] Updated the MaxDistance Gizmo in AIMReduction to be compatible with the AIMSpatialSensor
    • [Free/Pro] Backend: objectives can now be drawn by using a Property in addition to the Field
    • [Docs] Added additional information on AIMArrive and AIMContext


    @MrJBRPG,

    There are more parameters than only the magnitude multiplier. I highly recommend our YouTube channel and our Documentation for further reading. Good starting points for experiments are the mapping type and the inner/outer radius.

    Best wishes, stay healthy, and stay at home,
    Martin 'Zetti' Zettwitz from Polarith.
     
    PixelEnvision and BCFEGAmes like this.
  17. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    Hi Martin,
    Just thought I'd check the forums after so long, and look how busy it is! It's great to know that a June release might be on its way! One thing that might help, would be a "Simple" 3D Aim Controller, where the mapping from objectives to movement are close. I love what aircrafy, copter and spaceship can do, but they're quiet complex pieces of engineering, whereas in the 2D controller it's immediately visible. Take care and stay safe...
     
    Polarith likes this.
  18. Polarith

    Polarith

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

    Nice to hear from you, Sergio. You can use AIMSimpleController. It seamlessly works with AIMSpatialSensor. Of course, there is no physics behind but a direct movement. I think the SpacshipController is what comes closest to a 3D version of the PhysicsController2D. In my research, I've used the AIMSimpleController, too, for a fast and easy to use setup within a 3D environment.

    Have a great day and stay safe, too
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  19. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    Thank you! It's beautiful :)
     
    Polarith likes this.
  20. linq

    linq

    Joined:
    Jun 20, 2015
    Posts:
    7
    Can Polarith make something like that?
     
  21. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    Being a bit silly, but the question is not "can Polarith do this for me" but "can I do this with Polarith" ;) on a more serious note, it's clear from the video that's a biped crowd simulation, not the design case for the package I think, but with the multi-thread optimization, and effort, I guess similar results could be achieved, not out of the box though... Could be wrong!
     
  22. linq

    linq

    Joined:
    Jun 20, 2015
    Posts:
    7
    Sorry, my English is awful. I try to solve more easily task. I want that two cubes swap places. Cubes can't coordinate action between each other and stuck.
     
  23. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @linq and @Skorcho,

    We have experimented with smaller crowds as shown in the animation. It is possible, but note that the computational effort becomes large. We do support multithreading for this purpose, but 100k+ agents would not be possible with state of the art hardware for us, I guess. And honestly, you do not want the whole CPU to be a slave of our simulation rather than your game logics ;)
    formation-preview.gif

    Regarding your cube problem, you should add AIMStabilization to your agents to prevent wobbling.

    Good vibes and stay safe,
    Martin 'Zetti' Zettwitz from Polarith
     
  24. linq

    linq

    Joined:
    Jun 20, 2015
    Posts:
    7
    HI @Polarith, Thanks for your response. I use AIMStabilization in my example with cubes. Can you share with me source code of you crowd simulation?
     
    Last edited: May 18, 2020
  25. Polarith

    Polarith

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

    Unfortunately, we do not share any source code of our products other than our source code customers. Additionally, this code is under development.
    In your example, AIMStabilization is not active. Furthermore, it is hard to guess what might be not well parametrized if I can see only snippets of your configuration.

    In the example above, I've used passive avoidance only. Too many cooks spoil the broth, meaning too many behaviours might not yield the desired results. You can think of a mathematical function of higher-order that is hard to optimize. In your case, you can try active avoidance, passive avoidance, or use different radii for both of them. My educated guess is, that both (seek and avoid) have the same radii so that the behaviours are in competition.

    Happy exploring,
    Martin 'Zetti' Zettwitz from Polarith
     
  26. grimmgames

    grimmgames

    Joined:
    Jan 11, 2011
    Posts:
    50
    Hi Polarith,

    I have successfully integrated Polarith AI into our project with the final exception being spawned enemies are blind to the perceived environment (prototype enemies already in the scene work fine). Their context indicators correctly show AIMFollow positions or objects, but no context indicators appear for the three basic Seeks they are using. I have tried using the Layer and GameObject options in AIMEnvironment, as well as manually adding each spawned object at start to the LayerGameObjects or GameObjects lists respectively. I figure I am overlooking something really simple. Please advise.

    Thanks in advance!
     
  27. Polarith

    Polarith

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

    Concerning the more detailed information in your e-mail, the problem that appears is, that objects that are added to AIMEnvironment during runtime are not recognized out of the box. You need to register them in AIMEnvironment by calling UpdateLayerGameObjects() in AIMEnvironment after GameObjects are added.

    Hope that fixes your problem.
    Martin 'Zetti' Zettwitz from Polarith
     
  28. grimmgames

    grimmgames

    Joined:
    Jan 11, 2011
    Posts:
    50
    Unfortunately, the UpdateLayerGameObjects() method is the first thing I tried, and have been trying in various stages and in coroutines with delays, and on a UI button I can click whenever, as in the tutorial video. The only active object in the scene at start is the player, and that will change eventually too. Everything else is spawned at start via PoolManager, including my enemy agents with AIMContext, AIMContextIndicator, 3 seeks and 2 follows, with only 2 seeks and 1 follow active at a given time. I can call UpdateLayerGameObjects() at any time and it has no effect on spawned agents in the scene. Also, unless I am missing something, using the UpdateLayerGameObjects() method, either by default at start, or by calling it manually, will pick up every layer object, including children. Manually adding the objects via code during the spawning process is cleaner and guarantees only the parent object is included in the resulting list. All of these added objects make it into my AIMEnvironment lists, which I can verify with count, or by looking directly at them in the inspector if I add them as individual gameobjects as opposed to layer objects, so why they are not acting properly is a big mystery to me. The video tutorial that covers adding objects during runtime differs in that the AI agent in the scene is already there at start, and not spawned. I don't think I have seen any video that shows spawned or instantiated AI agents.
     
    Last edited: May 26, 2020
  29. grimmgames

    grimmgames

    Joined:
    Jan 11, 2011
    Posts:
    50
    The behavior I describe is easy to duplicate: Open the TinyWood example scene and disable GathererRay in the scene. Press play, then drag a GathererRay prefab into the playing scene. Instantiated Ray is blind. Enabling the previously disabled GathererRay scene object reveals normal behavior.
     
  30. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Hi Martin,

    I've just wanted to let you know that ContextIndicator is not working in Editor when Metal support is enabled, that's on MacOS with 2019.2.21. Extrude & Splat shaders are failing with "Shader is not supported on this GPU" error.

    Switching back to OpenGL mode fixes it but unfortunately it's not an option for me...
     
  31. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    AIMSteeringFilter needs an instance of AIMSteeringPerceiver, thus it can not be set in a preset. If you spawn agents at runtime, this must be set programmatically. Unfortunately, this is often overlooked.

    AIMContexIndicator uses geometry shaders. Unfortunately, they are not supported by Metal as written in the Unity Docs. Thanks for the hint, we were not aware of that.

    The week is half over - have a nice Wednesday!
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes and PixelEnvision like this.
  32. lekane

    lekane

    Joined:
    Feb 5, 2014
    Posts:
    3
    Hello Team Polarith!

    Your asset has been of great value so far in my project, congratulations are in order, it's very professional.
    Now I was wondering how you would go about setting up a "Keep at range" behavior.

    To give you some context, I have two NPC space fleets largely disagreeing on who the owner of the space should be, as a result they shoot at each other. Their weapons have optimal ranges which might or might not match. For now i have the individual ships orbit their target based on the optimal range of their respective weapons, and while space ballet is fun to watch, it doesn't feel optimal in a military sense (especially seeing as there is no turret tracking at play). Rather, i feel like a "Keep at range" behavior would improve the result and be less chaotic when many ships are involved. It would be very much like the Orbit behavior except without the roundabout part, but I'm not sure how to go about it.

    I could regularly create a waypoint along a line between the shooter and its target and seek for that, but I was wondering if you could think of a better option. Perhaps we can disable the turning around in the orbit behavior? Something else maybe?

    Thanks!
     
  33. Polarith

    Polarith

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

    we are glad that you like our product!
    There are multiple ways to achieve this. First, you can make use of the inner and outer radius of all Radius Steering Behaviours. The magnitude is interpolated only between the inner and outer radius. Thus, the agents won't move closer than the inner radius. Beware, this is the same as being blind when too close.
    A special option is AIMArrive. This behaviour slows the agents down towards the inner radius. Additionally, the agents may keep distance by using AIMSeek (mapped on danger environment) or AIMFlee.

    P.S. turret tracking is dope :D

    Happy to help,
    Martin 'Zetti' Zettwitz from Polarith.
     
  34. lekane

    lekane

    Joined:
    Feb 5, 2014
    Posts:
    3
    Thanks Martin, AIMFlee with an outer radius at the optimal range and a magnitude higher than the AIMSeek worked wonders, fleet fights makes a lot more sense, i threw in some AIMAdjust as well for good measure and it's pretty rock and roll now! The more agile and faster ships tend to rock back and forth but these will be using orbit ultimately and they will be allowed to ballet, bulkier slower ships will do great with this setup! I will be considering turret tracking down the road since it is in fact dope and it adds a fun defensive option. Thanks again!
     
    Polarith likes this.
  35. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    @lekane

    For more agile ships, a smaller Magnitude Multiplier and/or a different Radius Mapping may fix the space ballet. Additionally, a passive avoidance using AIMSeek to the other ships on Danger objective may help, too. You should give it a try ;)

    Space ballet fan,
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  36. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    How can you use Aaron AStar system with this? found this link http://docs.polarith.com/ai/manual-aim-path.html but it is not clear what must do, in the CalculatePath method i must set something like ai.destionation in the astar system? dont know what must do with this part :
    if (pathfinding.PathIsReady)
    PathChanged();
    Also AIMPathfinding is not found, it is PRO version required?
     
  37. rui-lima

    rui-lima

    Joined:
    Aug 22, 2019
    Posts:
    5
    Hi @Polarith guys, let's say we have the track points in purple below generated with a AIM Unity Pathfinding and a NavMesh.
    Is there an easy way to know if a car has to reduce speed in order to do a smooth turn (green path)? The deceleration would need to start happening before the middle way point otherwise the car would shoot pass the 3rd way point (red path).
    Placing triggers is not an option because this would not be always on a track sometimes is on open space with obstacles that moved.


    upload_2020-6-21_12-31-25.png
     
    Last edited: Jun 21, 2020
  38. rui-lima

    rui-lima

    Joined:
    Aug 22, 2019
    Posts:
    5

    Hi @NewMagic-Studio I think PRO version is required: http://docs.polarith.com/ai/class_polarith_1_1_a_i_1_1_move_1_1_a_i_m_pathfinding.html
     
  39. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
  40. rui-lima

    rui-lima

    Joined:
    Aug 22, 2019
    Posts:
    5
  41. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @NewMagic-Studio,

    Pathfinding is a feature of the pro version. Martin has given a brief guideline on how to implement custom pathfinding in this and following posts. They show some results and code snippets for custom pathfinding with A*.

    The push problem is solved by local avoidance, which is a core feature of our plugin. Therefore, you can use active (AIMAvoid) or passive (AIMSeek/Flee) avoidance. The system gets information to move to the next waypoint of the underlying pathfinding solution. In addition, new solutions are added by local obstacles so that in sum a resulting direction will follow the path but avoids local obstacles. You can find a demonstration on our
    YouTube channel.

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

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @rui-lima,

    Thanks for your helpful responses in the forum. This is an interesting question. If you want to stick to our system, Prediction may help. Otherwise, you could compute the angle between the next two waypoints. If it is large, your agent, controller respectively, should reduce speed.

    Have a great week as well,
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  43. rui-lima

    rui-lima

    Joined:
    Aug 22, 2019
    Posts:
    5
    Prediction seems a good candidate, thanks. Had miss that one. Will give it a try.
     
  44. MrJBRPG

    MrJBRPG

    Joined:
    Nov 22, 2015
    Posts:
    40
    So far, I implemented a rough prototype of opponent fish with basic Finite State Machine (FSM): seeking the player, then fleeing temporarily when close.

    It uses the basic A* pathfinding to determine points. Fish move dynamically with physics and waypoints get updated. The AI refreshes path-finding at time intervals. The fish AI has built-in waypoint distance buffer to move towards next waypoint easier.




    I am somewhat thinking of integrating Polarith AI for influencing direction of movement with one caveat: the direction is influenced by a virtual "joystick" like how computer players have FSMs that mimick player input. No added velocities from any Polarith AI 2d Physics movement.

    How can I utilize custom waypoints that constantly change to a unit that Polarith can read?

    Assuming that I have a basic FSM with defined behaviors through labels (enum), how can I make certain AI components be active through states?

    How can I utilize 2D physics to influence pathfinding and Polarith AI behaviors?
     
  45. Polarith

    Polarith

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

    I hope I have understood your question correctly: you want the dynamically changing waypoints as a general path for an agent. The agent should have behaviours from Polarith AI that are handled through FSM. At last, you want t use different 2d physics to influence the movement. Is this correct?

    1. Dynamically changing paths are no problem. First, you need the pro version for the waypoints/pathfinding module. Next, you need to pass these points to Polarith (AIMFollowWaypoints) and tell the system that the path has changed. You can find a more detailed description in our manual.
    2. Since our components are mono behaviours, you can simply enable/disable them on runtime programmatically.
    3. Our system forms the foundation for movement. It computes the target direction where the agent should move. HOW the agent actually moves, is up to the controller. In our example physics controllers, parameters such as torque or drag influence the linear and angular movement, inertia respectively.

    Hope I hit your questions,
    Martin 'Zetti' Zettwitz from Polarith.
     
  46. MrJBRPG

    MrJBRPG

    Joined:
    Nov 22, 2015
    Posts:
    40
    You seem to nail all of those questions. For #3, I can imagine using the target direction by getting its normalized direction and then applying that to the "virtual joystick" on the AI. When you mentioned physics controllers, it does make sense to have the controllers (Polarith default controllers or custom) be independent of the direction target calculator. I can use the direction on the "virtual joystick" to influence its movement.

    I guess I get the system down:
    Always have the path-finder running no matter the state on finite state machine.
    Use the finite state machine to turn behaviors on and off.

    I think that I can further experiment with the Polarith components.
     
  47. Polarith

    Polarith

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

    Dividing computation and controller is a good idea since this is the same in real life: the brain computes the path/direction and the body performs the movement, limited by its physics. Thus, the same logical movement can be transposed in different ways by the controller and vice versa, resulting in the diversification of the agents.

    Happy exploring,
    Martin 'Zetti' Zettwitz from Polarith.
     
    Last edited: Jun 24, 2020
  48. Prith1

    Prith1

    Joined:
    Mar 26, 2020
    Posts:
    6
    Hi Polarith! So I have a noob question here, So I have a list of waypoints that I have stored in my script, how can i reference these waypoint gameobjects for the AIM Follow Waypoints script via c# code. Please keep in mind that I'm not an experienced programmer and I found the documentation kindof overwhelming, so any detailed explanation / some lines of code would really help? Thanks in advance
     
  49. Polarith

    Polarith

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

    Everything you need is documented in our manual, including example code. You just need to add your points to the
    waypoints
    List and call PathChanged().


    Happy integrating,
    Martin 'Zetti' Zettwitz from Polarith.
     
  50. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    hi there,
    I noticed the Polarith web page doesn't host the AI middleware section any longer. Is a new web page in the making, with formation videos, to coincide with the update? I really hope that's the case...