Jump to content

How to use/create AI/PathFinding


photo

Recommended Posts

How to use PathRoute? How to make my own AI?

 

edit:

I found some pathfinding demos but i'm unable to make'em work, here is my c# code, i also have a NavigationSector

       
Init       
       route = new PathRoute(1);
        from = new vec3(001);
        target = new vec3(661);
         if (Visualizer.Enabled == falseVisualizer.Enabled = true;
 
Update       
        route.Create2Dfromtarget);
        if(route.IsReachedroute.RenderVisualizer(new vec4(1111));

 

Edited by jesus.zorrilla
Link to comment

I would recommend to start with C# Component samples, they are located in SDK Browser -> Samples -> C# Component samples:
image.png

Install the package and do a Copy as project in order to get an ability to load this project inside Editor. After that you can check the .cs components and how do they work.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thanks for your attention, I have no problems creating and adding components, adding nodes to the scene, applying forces, or transforming an element position.

 

What I'm struggling is with the pathfinding samples in samples directory, where as I can see I should:

1. Create a sector navigation object

2. Create a component, add to the scene.

3. Create a new PathRoute object and enable Visualizer on initiation

4. On update, call a route->Create2d(from, to)

5. Show on screen the results with route.Render.... 

 

But it doesn't work, IsReached always is false

Points aren't out of nevigatión object so I can see what's wrong.

NOTE: I'm doing it on C# and following a c++ example

 

 

Link to comment

These samples are written in UnigineScript, but should be possible to rewrite to C#.

If you are doing C# please check the C# samples, they also have a pathfinding examples:

image.png

If this doesn't help, please send us your current C# project (data folder will be enough). Right now it's not possible to fully understand what is going on.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thanks, it now works (pathfinding), Now looking for the way to move the actor to the target point.

 

Edited by jesus.zorrilla
Link to comment
×
×
  • Create New...