Answer the question
In order to leave comments, you need to log in
How to position the enemies at the points of the parabola?
Hello. I liked the mechanics in one game, I'm trying to implement it (wave-like movement of blocks behind the character). I was able to repeat it, only my blocks deviate linearly, and in the screenshot, as far as I understand, one branch of the parabola (Immediately, the offset is small, then it increases). I would like to see a formula by which you can find the points where the blocks should be located. Now the code looks like this:
// Позиция в которой располагается текущий блок
var nodeStoragePoint = _storagePoints.First;
// i используется для того что бы предать смещение блоку
for (var i = 1; i <= _storagePoints.Count; i++)
{
// _blockStoragePoint точка за спиной игрока от которой начинаются блоки
// по y блоки не двигаются, позиция по y задается при подборе блока и после
// не изменяется
var x = (_blockStoragePoint.position.x - nodeStoragePoint.Value.position.x) / i;
var z = (_blockStoragePoint.position.z - nodeStoragePoint.Value.position.z) / i;
nodeStoragePoint.Value.position += new Vector3(x, 0f,z);
nodeStoragePoint.Value.rotation = _blockStoragePoint.rotation;
nodeStoragePoint = nodeStoragePoint.Next;
}
MoveBlocks()
{
// Движение блоков к своей точке через изменение позиции в moveTorwards
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question