A
A
Alexey Fobius2020-09-06 14:22:21
C++ / C#
Alexey Fobius, 2020-09-06 14:22:21

Is it possible to specify an object using AddForce?

I will give an example, I need to specify the object to which I want to apply force for example:

object.transform.Translate (Vector3.forward * speed);

here you can specify the object itself, for example "object" this is ours - public GameObject object;

But I use force on it (push it), in addition, the script itself does not hang on it, and should not. The script hangs on the panel, and I need to do the same as in the example above, only with rb.AddForce (Vector3.forward * speed);

in this case, I don’t know where to push the object and how to specify it (if at all possible), I repeat I DON’T NEED TO HANG IT ON THE OBJECT ITSELF WHAT MOVES

googled but I didn’t find a specific answer to my question

(to the question why I can’t hang the script on the object itself, I’ll say this: touch control, and the script hangs on the canvas, or rather on the panel, it just checks the swipe and pushes the object)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question