jesus.zorrilla Posted April 23, 2020 Posted April 23, 2020 (edited) 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(0, 0, 1); target = new vec3(6, 6, 1); if (Visualizer.Enabled == false) Visualizer.Enabled = true; Update route.Create2D( from, target); if(route.IsReached) route.RenderVisualizer(new vec4(1, 1, 1, 1)); Edited April 23, 2020 by jesus.zorrilla
silent Posted April 24, 2020 Posted April 24, 2020 I would recommend to start with C# Component samples, they are located in SDK Browser -> Samples -> C# Component samples: 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
jesus.zorrilla Posted April 24, 2020 Author Posted April 24, 2020 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
silent Posted April 24, 2020 Posted April 24, 2020 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: 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
jesus.zorrilla Posted April 24, 2020 Author Posted April 24, 2020 (edited) Thanks, it now works (pathfinding), Now looking for the way to move the actor to the target point. Edited April 24, 2020 by jesus.zorrilla
Recommended Posts