Answer the question
In order to leave comments, you need to log in
How to make chaotic movement in Unity?
Good day!
I need to create an enemy that will dangle headlong across the field, while he should not stupidly sharply change the vector, but turn around in an arc. It should move something like this: it assigns a point on the field, flies there, when it flies it assigns a new point, smoothly turns around and flies there. How can this be implemented?
Game in 2d.
Answer the question
In order to leave comments, you need to log in
I solved the issue this way: I created an object child of the character and used it as a direction of movement. When a new point became a target, the guiding object was rotated to it via Slerp.
Hello.
This can be done using the Random method .
static Random rnd = new Random();
minValue = 20;
maxValue = 100;
int result = rnd.Next(minValue , maxValue ) // Выдает рандомное число в диапазоне которое привязывается к координате.
// Если точки нужно X и Y например, то 2 просто повторите rnd.Next.
use Random.Range( min n, max n ), it will return a random value within the minimum and maximum numbers given in brackets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question