Hodo33 Posted March 22, 2018 Share Posted March 22, 2018 I can't find much info on the navmesh tool. I have a bot in the nav area but not sure of any script commands I can give it to spawn, shoot, chase or hide. I saw a couple videos on setup and testing but nothing about how to use it in game.. any help or pointers ? Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted March 22, 2018 Share Posted March 22, 2018 Originally the nevmesh was a 3rd party resource before the author was nice enough to open source it. Here's the original documentation on how it works.http://yorkshirerifles.com/random/Walkabout_Documentation.zip Quote Link to comment Share on other sites More sharing options...
Duion Posted March 22, 2018 Share Posted March 22, 2018 Well you need to program the AI yourself, the navmesh is just for navigation, but you can use BadBehavior, it comes with a few example behaviors for AI players. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted March 22, 2018 Author Share Posted March 22, 2018 Thanks for the reply. I will have a look at these things. I have developed my own AI system and thought the navmesh was a A* technology for moving the bots around. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted July 23, 2018 Author Share Posted July 23, 2018 I got the navmesh to build and I can run the bot around, works fine. Question is I have an aiPlayer I created, how do I make this bot associate or know about the navmesh?I call %bot.findNavMesh() and it returns -1 I note in the c++ the line "Get the NavMesh object this AIPlayer is currently using" I dont see how to make my aiPlayer "use" this navmesh. How do I point my ai to the mesh? Quote Link to comment Share on other sites More sharing options...
Duion Posted July 23, 2018 Share Posted July 23, 2018 Quote from code I use in Uebergame, it is a move command, that works with and without NavMesh, the Bot will check if a NavMesh is existing and if so uses the NavMesh and if not uses a fallback no-NavMesh navigation system.I would recommend to use an AI system such as BadBot which I use, otherwise you have to code your AI yourself, which is not that hard for the basics, but a framework makes things easier. // moveTo command, %dest can be either a location or an object function BadBot::moveTo(%obj, %dest, %slowDown) { %pos = isObject(%dest) ? %dest.getPosition() : %dest; if ( %obj.getNavMesh() ) { %obj.setPathDestination(%pos); //setPath uses navMesh } else { %obj.setMoveDestination(%pos); //old function wihtout navMesh } %obj.atDestination = false; } Fell free to rip off my implementation. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted July 24, 2018 Author Share Posted July 24, 2018 Well I got it mostly working. I discovered you have to do navmesh.build() when the game loads. I notice in the navmesh description the line vehicles = "0"I changed that to a 1 rebuild and the bots still collide with any vehicle. Any way around that ?thanks for your help by the way, checked out your game, impressive... Quote Link to comment Share on other sites More sharing options...
Duion Posted July 24, 2018 Share Posted July 24, 2018 You don't have to do navmesh.build or whatever, the navmesh is build in the navmesh editor and then saved to a file. The navMesh is not dynamic, it is build once and then used that way as rebuilding it would cost too many resources and take too long. Only thing you can do is rebuild parts of the navmesh, which can happen fast enough, I have seen this in a demo from the user @Azaezel in his game, where he used it to rebuild the navmesh around characters, so they do not get stuck. In my game I do not bother with it that much, since the bots are usually dead before they can get stuck, additionally I have a push function so you can push other players out of the way which helps also. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted July 24, 2018 Author Share Posted July 24, 2018 Ok starting to make more sense. I made the navmesh and it saves in my mission file is that what you mean? If so it wont work unless I do a build at load time. I can get in edit mode and tell my bot to follow me and it works fine but in game it tells me there is no valid mesh Quote Link to comment Share on other sites More sharing options...
Duion Posted July 24, 2018 Share Posted July 24, 2018 I have no idea what you did, the NavMesh works by default, you do not have to do anything, so if you broke it, you have to tell us how you broke it, or reset to a clean working build. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted July 25, 2018 Author Share Posted July 25, 2018 Yeah after I get in game I do a build, tell the bot to follow me and all is well.I never touched any of this code, first time I tried to use it.I do get alot of spam on this:No contours in rcContourSet for NavMesh 21533Is there a depth issue with this object? like if I place it right on the surface or slightly below ? Sorry to be such a pain.... Quote Link to comment Share on other sites More sharing options...
Code_Man Posted October 9, 2018 Share Posted October 9, 2018 I have been trying to use the navmesh, but it seems setPathDestination does nothing and without any documentation ive no idea how to debug this. Quote Link to comment Share on other sites More sharing options...
Duion Posted October 9, 2018 Share Posted October 9, 2018 @Code_Man no need to debug the Navmesh, since it works fine, you "only" have to debug your implementation of whatever you try to do.In the Navmesh editor there is even a button to spawn a test bot and you can direct him around, then you can see how well the Navmesh works, so that is proof that it works. Quote Link to comment Share on other sites More sharing options...
Code_Man Posted October 9, 2018 Share Posted October 9, 2018 Im pretty sure i used the navmesh move command properly, but will tripple check then.I will give the navmesh test bot a try. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted October 26, 2018 Author Share Posted October 26, 2018 Well navmesh works better now that I altered a few things. I have a situation where I have 3 nav meshes but only one should be active per mission so I load the proper one for the mission. Changes I was making did not save properly so I have taken to adding the mesh to the mission, do a build, then delete the saved one, save the game and it all updates properly. During the mission I load the proper mesh out of the mission file and everything seems to work ok now. Thanks for all your help... Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted March 5, 2019 Author Share Posted March 5, 2019 Ok back to this. I don't know if this is the right way but it works. I find when I edit the mesh it won't over write the levels/zone.nav so I delete that file, edit and save the game, all is well. Navmesh works fine at this point. I had a question before about my character driving a vehicle into the area and the bots collide with it and you said "Only thing you can do is rebuild parts of the navmesh, which can happen fast enough" ... Can you tell me how to rebuild parts around where the vehicle sits. Seems if I move the vehicle within the mesh and jump out I have to do a instant rebuilt ?Thanks for any help Quote Link to comment Share on other sites More sharing options...
Azaezel Posted March 5, 2019 Share Posted March 5, 2019 https://github.com/GarageGames/Torque3D/blob/5b8f316d804e4df2cf2b4748e5a64e6b44353204/Engine/source/navigation/navMesh.cpp#L104 / https://github.com/GarageGames/Torque3D/blob/5b8f316d804e4df2cf2b4748e5a64e6b44353204/Engine/source/navigation/navMesh.cpp#L126 Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted March 5, 2019 Share Posted March 5, 2019 @Code_Man I'd double check, but setPathDestination is specifically for path nodes which is different to setMoveDestination which is a pathless command to set the destination of the AI, it is the latter command that uses the navmesh.@Hodo33 I think Az is pointing out that you can update smaller parts of the navmesh in a more dynamic fashion (runtime, particularly id, expect without looking in more detail), a full rebuild isn't really warranted apart from probably when doing more development work on a level, i suspect the documentation posted by steve will help muchly in this regard :) Quote Link to comment Share on other sites More sharing options...
Azaezel Posted March 5, 2019 Share Posted March 5, 2019 right. sorry. yeah. to use a script example from our objective-doors: function staticshapeData::onOpen(%this,%obj) { NavmeshUpdateAll(%obj,false); //false = ignore for cutout purposes, true = include } the second links there as an alias cause the first methods got a fairly unintuative name, so likely deprecate that at some point. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted March 6, 2019 Author Share Posted March 6, 2019 I used the NavmeshUpdateAll and the NavMeshUpdateOne got in the editor and there is no clear area around the vehicle, same with hovercraft I open the editor and where it is blue the bots can walk. After calling this update it is still blue and bots still collide. The vehicle has a collision on it and I did a getWorldBox to make sure that was valid as well... any ideas ? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted March 7, 2019 Share Posted March 7, 2019 https://github.com/GarageGames/Torque3D/pull/2335 took a bit to hunt that little bit of oddness on down. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted March 7, 2019 Author Share Posted March 7, 2019 @Azaezel and all others ... Sorry to take up so much of your time on this. I will make the engine changes and report back.Thanks to all for quick response .... Quote Link to comment Share on other sites More sharing options...
Azaezel Posted March 7, 2019 Share Posted March 7, 2019 No problem at all. After all, I use it myself, as noted upthread. Thanks for bringing the new issue to my attention so I could stomp it. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted March 7, 2019 Author Share Posted March 7, 2019 Got it in but not sure it's working properly. First off I use 3.8 ..and called NavMeshUpdateAroundObject. In my version the function didn't have a reference to mPathfindingIgnore in sceneObject.cpp / h so I added that but I can make the call and it returns. Not sure if the "ignore" is the only equate for that. Anyhow here is a link to a pic. I drive the vehicle in and make the call on exit and you can see the result ... http://www.hyperkat.com/Images/navmeshIssue.jpgSince this function checks worldbox and a vehicle box is off the ground because of the tires and the bot reference is on the ground do you think this might be an issue?If something protruded from a wall at waist high the bot will run into it? Or the octree checks for any path obstruction in vertical from worldbox on bot player.? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted March 8, 2019 Share Posted March 8, 2019 Got it in but not sure it's working properly. First off I use 3.8 . https://github.com/GarageGames/Torque3D/commits/development/Engine/source/navigation yeah... you're gonna wanna go through that end with a fine toothed comb if you're gonna try to stick with an otherwise 4 point-release-behind codebase.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.