News › Forums › RAIN › General Discussion and Troubleshooting › Move ignoring close enough distance in repeating node
Tagged: close enough distance, move
This topic contains 9 replies, has 3 voices, and was last updated by strangegames 11 months ago.
-
AuthorPosts
-
December 1, 2022 at 10:42 am #39587
I’m having an issue where the AI seems to ignore the close enough distance in the move action as well as in the motor controller. This seems to happen if the move action is in a node that repeats. I setup a basic bt as follows:
Para (fail any, succeed all ) Detect ( repeat forever ) Select ( repeat never ) constraint ( target != null, repeat never ) move ( close enough distance = 10, repeat never ) expression ( test = 1, return success )
This works and the ai moves to the target and stops 10 units away. If however I change the Parallel to (fail any, success any), the AI moves all the way to the target. The move does return true for one frame but on the next frame it resumes running and moves all the way to the target before stopping and returning true. The expression is used for debugging and setting a breakpoint there shows the move does return true for one frame before resuming on the next frame an attempting to move all the way to the target.
It seems like when the move first returns true, the tree resets and the move then begins executing again ignoring the fact that it’s close enough.
I’ve found that setting the select to repeat as well as the constraint to repeat also causes the move to attempt to move past the close enough distance. It seems to be related to move not behaving well when it’s in a repeating node.
One other thing I’ve noted is when the target’s collision mesh is enabled, the ai moves up to where it collides and doesn’t move further. When the target’s collision mesh is disabled, it moves all the way to the target’s center. In both cases, move doesn’t return true until about a quarter second after it stops moving. It’s like it keeps trying to move and only returns true after it can no longer move for a few frames.
Is this a bug or am I doing something wrong?
Thanks,
Reggie- This topic was modified 11 months, 2 weeks ago by Sigil. Reason: added code block
December 3, 2022 at 4:26 pm #39608Are you running the latest RAIN or is there anything else going on in your tree by chance? I built your tree (close to the same, all the same critical structure at least) and I can’t replicate the issue. When I ran the exact same setup I got through the move once, as in it got close enough, stopped and hit the expression after it. When I changed it to succeed any it continued to hit the expression over and over but it never moved any further. Same when I put a repeat on the selector or constraint.
Now that’s not to say I haven’t seen this behavior before (it sounds familiar) but I can’t recall if it was a previous version or if there was another factor involved. I can’t seem to repeat it with this particular setup though.
If you can put a small project together I can also take a look at that.
December 3, 2022 at 4:52 pm #39613I’m on Unity 5 with Rain 2.1.11.0 which seems to be the current version. I’ll make a small test project for you to see it happening.
Thanks,
ReggieDecember 7, 2022 at 3:31 pm #39626It seems that the problem may not be related to the repeating node. I created a very basic test project with two cubes. When you run it, one cube attempts to move to the other cube and will go up and stop at the close enough distance the majority of the time. I’ve found the easiest way to cause the issue to happen is to go into the scene view after the AI cube has moved to the target and stopped. You can then drag the target cube a few spaces at a time away from the AI cube. Each time you drag, the AI should move the corresponding same small distance. After two or three moves, it will usually ignore the close enough distance and move all the way to the target.
I’ve noticed another issue on this test scene. It seems the AI cube often doesn’t take a straight line to the target cube. It seems like the navmesh hasn’t generated an optimal mesh for just a basic plane but even so, I would have expected it to always come up with a straight line. It usually picks a straight line but if you move the target around, it will frequently take a longer path to get there.
http://atlbiz.com/raintest.zip
Thanks,
ReggieDecember 13, 2022 at 4:46 pm #39718Repro projects are the best! Support should have an easy repro now!
December 14, 2022 at 9:40 am #39731I use a custom action to calculate the distance and I put a constraint before Move which checks the distance.
December 14, 2022 at 9:55 am #39732I think I may have to use custom actions to fix a lot of things. I just wished the move action worked as expected.
December 14, 2022 at 12:01 pm #39740Sorry, this got lost in my mail somewhere, not sure why I didn’t see it. I’ll take a look at that project and see what I can do. The move node has been around awhile and should be working as you expect, so we’ll see what I find.
As for the pathing issue, depending on how the Navigation Mesh is broken up sometimes the AI generates a path that seems suboptimal. We’ll be adding something for the next version of RAIN to fix this, allowing the AI to take straight lines to its target when it makes sense.
December 14, 2022 at 12:47 pm #39744Thanks Sigil. As I’ve worked on this the past week, I’ve found the AI just don’t move very well. They almost always ignore the navmesh and try to move through geometry even though “off graph move” is not selected. The NavMesh has holes around the geometry but they don’t seem to use the navmesh at all. This coupled with the fact that they only stop when they should half the time makes the AI system very unusable for me right now.
Thanks
ReggieDecember 17, 2022 at 1:03 pm #39780Any update on this?
Thanks,
Reggie -
AuthorPosts
You must be logged in to reply to this topic.