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).
You could do something simple like this in a tick:
- Create vector between bot and target. (Direction = TargetLocation - BotLocation)
- Check length of Direction vector. Is it within “reached distance” to target? (use a buffer, for example 100 units)
- If not; normalize Direction.
- SetActorLocation(CurrentPosition + NormalizedDirectionSpeedDeltaTime)
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.