Random 3D movement

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Vikrant

I want to make enemy move randomly arround the map. When i implemented this, my enemy get stuck in game’s geometry, I tried to use navigation node enemy always move towards origin of navigation node.

Pls Help me to get around this.

Have you tried random rotation left or right?

ramazan | 2021-05-21 16:35

yah this seems to help


Vikrant | 2021-05-22 16:03

:bust_in_silhouette: Reply From: Tato64

I dont know if you want a specific behaviour, but what you could do is send the enemy in a random direction and then use a raycast to check if there’s something in front and when the raycast collides with something, the enemy choses a new random direction.

:bust_in_silhouette: Reply From: Dayls

You could create points in random position in which direction your enemy will move. If enemy hits this point (or area) then will be created new point etc.