Announcement

Collapse
No announcement yet.

Creating patrol routes for simple enemies?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Creating patrol routes for simple enemies?

    I've created a game from scratch, and want the enemy bots to move along simple paths (with no real intelligence, just movement). With the pathways as they are, I have to have a long string of timelines increasing/decreasing coordinates in their transforms, with rotations between the movements. Is there a simpler way I could do this? I've tried AIMoveTo, but the bots don't seem to move when this is used (I've added a NavMesh, but my floor is made of static meshes and not a BSP, and must remain that way as far as I know).

    #2
    You could do something simple like this in a tick:

    1. Create vector between bot and target. (Direction = TargetLocation - BotLocation)
    2. Check length of Direction vector. Is it within "reached distance" to target? (use a buffer, for example 100 units)
    3. If not; normalize Direction.
    4. SetActorLocation(CurrentPosition + NormalizedDirection*Speed*DeltaTime)

    This should move the bot towards the target every tick at a constant speed, then in step 2. do whatever you need it to do when it reaches the target.
    Programmer, Rigger, Animator - Demo Reel 2015 - My RnD / WIP thread - www.dennylindberg.com
    Worked on: Kitten'd - Guardians of Valor (Android, iOS)

    Comment

    Working...
    X