Question by
HumptyDumpty · Mar 13, 2017 at 02:19 PM ·
raycast
I want an object to move forward (hit it) when I click/and tap (android) on it
I've got this object in a game I wanna try and make, I want it to get "hit" when clicking it, so it moves forward. I've done this years ago but I left it and I forgot how to do it.
Comment
Answer by Desoxi · Mar 13, 2017 at 02:49 PM
I think the easiest and best solution would be to add a rigidboy to that object and call the AddForce() method of it when tapping the object: https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html
There are a bunch of other solutions though, it depends on which effect you want to have. I would try the addforce method first and play with the parameters :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612113104im_/https://answers.unity.com/themes/thub/images/avi.jpg)