- Home /
Need help in the stone throwing mechanic with aiming for mobile in Unity3d
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:
(Bump Question)
Answer by JustAbhi · Apr 09, 2020 at 01:01 PM
have you tried using a parabollic trajectory for your gameobject to throw?
I have the formula for the projectile, I'm just stuck at the moment in regards to how am I going to implement it, since I need to do the following:
Touch the object first, then dragging it forwards for the power while moving left and right for the ai$$anonymous$$g aspect (not to mention that there's also supposed to be a guide in regards to the aim in the stone.
When releasing the finger, the projectile will launch to its destination.