A
A
artur_agishev2020-10-30 21:35:17
C++ / C#
artur_agishev, 2020-10-30 21:35:17

Unity 2d initial movement?

How to implement the code in the Start() method so that at the very beginning the object has a random direction of movement in 2d? I'm just a newbie, please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2020-10-31
@artur_agishev

You can move along the axis and against the axis.
Accordingly, the vector of your movement must be either negative or positive.
Write a function that will randomly produce either 1 or -1 and multiply the result of this function by a vector.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question