How do I move an object in a certain direction, regardless of where it is turned?

There is an object, it moves in a certain direction like this: transform.Translate(0,0,speedTime.deltaTime); There is a second object, it should move in the same direction as the first one, cub. transform.Translate(0,0,speedTime.deltaTime); -if he has such a code, then when he turns in the other direction, he will be heading in his own direction, and not in the direction where the second object is heading. The answer is like getting the coordinates of the first object and assigning it to the second one is not veren, you need exactly the direction.

Author: даня шитов, 2020-10-05

1 answers

You need to specify what you are moving in world coordinates. It should help.

transform.Translate(someVector, Space.World);
 0
Author: Andrew, 2020-10-05 21:16:32