News › Forums › RAIN › General Discussion and Troubleshooting › Random Navigation Target
This topic contains 9 replies, has 2 voices, and was last updated by binary 1 month ago.
-
AuthorPosts
-
January 5, 2023 at 11:33 am #34985
Hi,
for a rouge i’d like to have my monsters wander between random placed points ( Navigation Targets ).
Basically i try to do what the sample ChooseWanderPosition does but with defined POI’s.
I found NavigationManager.Instance.GetNavigationTarget(name) so far but i need a list of all random generated NavTargets, which is not exposed by NavigationManager, so i could pick one randomly.How do i get all NavigationTarget’s?
- This topic was modified 1 month, 2 weeks ago by binary.
January 6, 2023 at 9:25 am #34996Unfortunately, the accessor you need is missing from the Navigation Manager. That’s an oversight on our part and I just added it. A Property that returns a readonly list of all registered NavigationTargets will be available in the next release.
Until then you might just keep your own global list of nav targets as you randomly generate them.
January 7, 2023 at 3:18 am #35012Thank you!
In general, how do i get such a reference into an Action?
Atm i have an extra GamObject say, POI_Collector that does a FindObjectsOfType<NavigationTargetRig>() and copy’s the targets from the rigs into a List. In the Actions Start() (how often is this called anyway?) i do then a Find(“POI_Collector”) to get to my List …
I know that’s not good practice, how is it intended to be done? How can i feed data by value/reference into the AI?- This reply was modified 1 month, 2 weeks ago by binary.
January 8, 2023 at 7:18 am #35020The Start action is called every time a behavior node is run, except when that node is already running. The nodes themselves can keep history - they aren’t destroyed and recreated as the tree is run, so often you will do a check like:
if (tCollectorObject == null) { tCollectorObject = Find("POI_Collector"); }
This means the expensive call will only ever happen once, even if Start is called multiple times.
Since your POI_Collector is already in the scene, you could just add an entry to the AI Memory in the inspector. GameObject is one of the valid types, so you could set it up in advance and avoid the Find(“”) call at runtime.
January 9, 2023 at 1:58 am #35031Nice, got it now. Thanks for your patience and not RTFM’ing me.
January 11, 2023 at 8:23 am #35046Sooner or later my AI’s get stuck when this kind of graph gets generated:
Look here pls
(Allow off graph move is off)The AI could have walked that same way several times before, without any problems but sooner or later this happens by chance.
Any idea why this happens and how to avoid it?January 11, 2023 at 5:17 pm #35051Not sure - it’s a little hard to tell from that screen shot. Is the destination target moving or stationary?
January 12, 2023 at 2:26 am #35055Stationary NavigationTarget. From where the graph hits the mesh, everything is calculated correct on the nav mesh.
You can grab my test runtime here:
MutantWatch
‘G’ generates a new level and ‘C’ cycles through cams.The error happens by chance in the bigger hall down at the green lit door. Maybe you can spot something.
January 13, 2023 at 9:52 am #35067First off - your game looks really great so far. Those are randomly generated levels? Awesome.
As far as the pathing issue - we think we know what that is, and we think it is fixed in the new version of RAIN we’ll be releasing this week. If you need the fix sooner, email jester (@rivaltheory.com)
Thanks
January 23, 2023 at 9:47 am #35244Thanks!
The recent release (2.1.8.0) fixed the problem. -
AuthorPosts
You must be logged in to reply to this topic.