T
T
Timofey Bulgarian2017-04-13 21:02:05
Physics
Timofey Bulgarian, 2017-04-13 21:02:05

How to reset the speed in the direction of another object?

There are objects 1 and 2. 1-moves with some speed in the direction of its velocity vector. As you know, a vector can be decomposed into components. It is necessary to make sure that object 1 does not approach object 2, that is, zero the vector component that is directed towards object 2 (if it is not directed in the opposite direction). Question-How?
I only know a method with a bunch of sines, cosines, but there are a lot of such calculations to be done, so speed is important, can Unity (built-in functions) be able to solve it somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Pogrebnyak, 2017-04-14
@Arhin

rigidbody.velocity = 0f;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question