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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #34521

    Jaroslav
    Participant

    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!

    #34522

    prime
    Keymaster

    Setting 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?

    #34542

    Jaroslav
    Participant

    My 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.

    #34549

    prime
    Keymaster

    I 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?

    #34587

    Jaroslav
    Participant

    Yes, 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.

    #34593

    prime
    Keymaster

    I’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)

    #34612

    Jaroslav
    Participant

    OK, 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)

    #34615

    Jaroslav
    Participant

    I 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?

    #34618

    prime
    Keymaster

    This 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.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.