News Forums General Discussion Question - Resuming a patrol using a timer.

This topic contains 3 replies, has 2 voices, and was last updated by  prime 4 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34321

    daviddixon88
    Participant

    Im trying to get my Ai to stand in front of an object that isn’t moving for a set amount of time and then go back to patrolling. So far when the object comes into their vision they walk over to it and change to an idle animation. Near and far sensors are being used but as the object stays in the near view they never resume the patrol after the timer has ran out.

    I realise this is probably something easy to do but I haven’t even been using rain for a 2 days yet so any advice would be helpful :)

    #34326

    prime
    Keymaster

    What’s the idea of the near/far sensors? The far is for detecting and the near is telling you when you are close to the object? How do you decide when to go to the object (always, whenever you detect it?) and how do you decide when to ignore it (simply time based?)

    #34390

    daviddixon88
    Participant

    If the object comes into the far sensor its walked towards, the near sensor tells it when its actually arrived and how close to get to it. I would like it to play an idle animation for a defined amount of time and then resume the patrol and ignore the object. So yes its simply time based

    #34409

    prime
    Keymaster

    A couple of thoughts for you:

    1) you probably don’t need the near sensor to tell when the AI has arrived. Just setting a close enough distance in your Move node and running it until Success should do the trick. Nothing wrong with the near sensor generally, but you may not need it.

    2) you probably need something like a second timer or an alternate state for your AI so that it knows when to stop looking. The object it is looking at will still be in the sensor range after your wait timer expires. I would probably
    - only run the detect node while you are patrolling
    - store the last object detected in a variable
    - ignore any detected objects if they are == to the last detected object
    - clear the last detected object variable after some amount of time

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

You must be logged in to reply to this topic.