- Home /
Need help in Stone throwing mechanic with aim in unity 3d C#
I really need to find a way to create a better throwing mechanic for mobile in unity. For aiming seems to be hard with the current code that I am using atm. I need to find a way to increase power by pulling back (which determines the distance of travel) while aiming left and right, then if I release my finger, then the ball will launch and land on the area that I aimed on.
How do I do this in C# in unity? (Note: I have tried 6 different codes as far as I found in the internet, and the code they wrote is of the same variant as the one I got)
The code that I have wrote so far does the following:
press the object, then I can apply power by moving only a little away from the object to launch powerfully, or moving my finger far to the edge of the screen to have the lowest launch power.
When I release it, the ball will launch accordingly. Though I must attest, the mechanic I wrote was only used for flicking objects, not necessarily aiming them.
Here's the pic of the play area and the code that I'm using for the throwing mechanic: