News › Forums › RAIN › General Discussion and Troubleshooting › How to stop at last waypoint
This topic contains 8 replies, has 2 voices, and was last updated by prime 1 year, 4 months ago.
-
AuthorPosts
-
December 4, 2022 at 3:13 am #34521
Hello,
I have waypoint route and AI that uses it. How to make AI stop at last waypoint? I thought that when I set loop to one way,that would set it up, but I was wrong. I know how to do it through code, but I would like to know, if there’s easier solution as I am not familiar with components like waypoint network and navigation points.
Thanks!
December 4, 2022 at 7:39 am #34522Setting the loop mode to One Way will make the AI stop at the last waypoint.
I just created a quick scene with a waypoint route, created a behavior tree with a waypoint patrol node set to one way (and a Move node as a child) and ran it. Does just what you want. If the AI is not stopping then something else is going on in the behavior tree to cause it to keep moving. How is your BT set up?
December 5, 2022 at 1:41 am #34542My BT:
I also tried this simple one:
It looks like my npcs run in loop mode BUT they start from 2nd waypoint, not first.
I also tried my other npcs and they all behave like this. Loop and ping-pong work fine.
December 5, 2022 at 7:18 am #34549I can’t reproduce that problem. Can you share an example scene? This is with 2.1.6? Seems like an issue like that existed in an old version…
Also, your parallel is set to Succeed on what? Any or All? And your Run animation, is it set to Looping in the RAIN Animator?
December 7, 2022 at 2:27 am #34587Yes, everything’s all right. I already tried almost anything, only thing I managed to do was that NPC finally stopped at last waypoint but it ignored all waypoints between first and the last. I’m lost and unfortunatelly I cannot share the scene right know.
Maybe if you had little time you could try to write your own working BT with similar behavior and I would try it and we would see whether there is a problem in my BT or in Unity/RAIN.
December 7, 2022 at 7:00 am #34593I’ve added an example into the Starter Kit sample project. We’ll post it out this coming week. However, my BT only has two nodes:
Waypoint Route (Loop=One Way, Direction=Forward, Move Target Variable = moveTarget)
— Move (Move Target = moveTarget)December 8, 2022 at 2:17 am #34612OK, thanks. I created brand new scene, using just models from the buggy one and the behavior is still same. I have this really simple BT you wrote and simple waypoint patrol but when I change Loop to One Way the model don’t stop at last point, it skips the first point and continous from the second as in Loop=Loop mode. I am really confused from, this.
I replaced model with capsule, so I can share my scene : https://www.sendspace.com/file/uz9uvn (hope everything’s included)
December 8, 2022 at 4:33 am #34615I tried to stop at last waypoint using thix expression:
moveTarget.VectorTarget != lastWaypoint
where moveTarget is from waypoint route and lastWaypoint is Vector3 variable in memory with same coords as the last waypoint. The problem is that expression is not valid (it is red). Why?
December 8, 2022 at 3:22 pm #34618This part of the expression: moveTarget.VectorTarget
is not valid in a RAIN Expression. We don’t currently support property accessors in expressions. You would have to do that check in code. Again, however, you don’t really need to. A one way waypoint route will stop at the last waypoint. -
AuthorPosts
You must be logged in to reply to this topic.