Touch Force on 3D Object
Okay, so I know that this is going to sound like a super vague question and I'm sorry but I've been searching all over the internet on how to get what I want working and I just can't find it. I'm trying to create a simple mobile game for my brother in law's birthday. It is going to play like one of those cat ball towers and I want the player to tap on the ball to keep it going around the tower for as long as possible. I have everything set up from the assets to the UI but I just can't figure out how to get the balls to move when they are touched as I've never done a 3D game that is not controlled by more traditional directional controls. I know this is asking a lot but could someone point me in the right direction to help me get this done.
P.S. Below is a link to what kind of toy I am talking about.
Okay, I'm still desperately looking for a way to apply force to an object along a spline. If anyone out there knows how to make this happen please let me know!
Answer by b1gry4n · Aug 30, 2016 at 11:38 PM
Sounds like you want the ball to follow a "path" or a spline. When the player presses the screen, cast a ray from the camera into world space (just as if the player clicked the mouse on the screen). There are plenty of tutorials around for that.
http://answers.unity3d.com/questions/332085/how-do-you-make-an-object-respond-to-a-click-in-c.html
http://answers.unity3d.com/questions/366249/clicking-on-objects.html
http://forum.unity3d.com/threads/detecting-mouse-click-on-object.19450/
https://www.youtube.com/watch?v=-0eqAUkKQpI
If the player clicks on the ball, make that ball increase a speed value that moves it along a spline.
Heres a spline tutorial :http://catlikecoding.com/unity/tutorials/curves-and-splines/
The tutorial covers "walking" along the spline.
Answer by fralas1354 · Aug 31, 2016 at 06:36 PM
That was definitely what I needed. The spline method was something I had never used and works much better than how I was trying to set it up. I understand the onclick portion of the code I just didn't know if that worked the same on mobile as it would on a PC. I can't seem to find a method to apply force on the object along the spline when clicked on though.
Your answer
Follow this Question
Related Questions
Touch screen Input Help 1 Answer
Need help with a design approach regarding SkinnedMeshRenderer items 0 Answers
Tracked Alias Facade script problem 0 Answers
ScreenToWorldPoint not working 1 Answer