News Forums Troubleshooting Random waypoint ?

Tagged: 

This topic contains 9 replies, has 3 voices, and was last updated by  Snuffles10155 10 months, 3 weeks ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6772

    Snuffles10155
    Participant

    Is it possible to randomly select a waypoint to go to on a waypoint network while an AI is patrolling on a network ? Trying to avoid an obvious pattern in patrols here.

    Can you also trigger certain events to happen when they reach certain waypoints ? Eg. play an animation on Waypoint 5 ? If so how do you access this information ?

    #6775

    Iuxeayor
    Participant

    I’m interested in this question too. ;>

    #6785

    prime
    Keymaster

    I ran into this issue myself the other day and realized that we had initially intended to make this easy, but had lost the feature somewhere along the way. That’s why waypoints can have names…

    We’ll look into making some changes so you can access waypoints by name and get access to the current waypoint destination in code/BT. Right now you can tell when you reach a waypoint - it happens when your move node returns true from inside the waypoint node. You would just need to add additional nodes after the move (and have access to the current waypoint.)

    #6800

    Snuffles10155
    Participant

    What do you mean by additional nodes exactly ? Do you mean add a random node after move in the behaviour tree ? Probably just drawing a blank here and its obvious what you said

    #6802

    prime
    Keymaster

    The waypoint nodes look like this:

    - WaypointRoute
    — Move

    To take an action after you reach the next waypoint, do this:

    - WaypointRoute
    — Move
    — ReachedWaypointaction

    #6809

    Snuffles10155
    Participant

    Ok that makes more sense, except the only two nodes I can create are WaypointPatrol and WaypointPath, and im using a Waypoint Network for my routes

    Currently I am using waypointPatrol node for my behaviour tree and that works fine for going through all the waypoints, should I switch to waypointPath instead ? How could I then use this for random waypoint selection.

    Looking at the random node trying to figure it out right now, would I have to create a custom action from that to have code that randomzies a variable which would contain which waypoint to go to ? Or is there another way I’m missing?

    #6822

    prime
    Keymaster

    What’s the purpose of moving to random waypoints? Are you trying to actually follow the waypoint path? Or do you just want to mark world locations to choose from, and then move to one at random?

    #6832

    Iuxeayor
    Participant

    I would be using it to mark world locations to choose from, but I’m not the original poster. ;>

    #6835

    prime
    Keymaster

    @luxeayor - In your case, you might consider using NavigationTargets instead. Their purpose is to mark world locations that you can move to by name. They work like this:

    - Add a Navigation Target from the main menu. It will create an object with a NavigationTargetRig attached and drop it to ground (or closest collider) in front of the camera. In editor it looks like a single waypoint.
    - Change the game object name to something relevant (e.g., “HidingPlace”)
    - In the BT, you can move to the nav target by setting the name of the game object as your move target (e.g., Move Target = “HidingPlace”)

    #6841

    Snuffles10155
    Participant

    My goal is similar to luxeayor so sounds like that will work thanks prime :)

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

You must be logged in to reply to this topic.