Making A Perfect Throw (The Code!)
Added 2018-02-02 00:37:56 +0000 UTCOk, first, go read the post that covers the topic.
Good? Good.
Now then, "well what does that code look like". Here you go.
It really is pretty self-explanatory, and already documented. Inclination in degrees, start pos, end pos, it hands you back a velocity. Put a rigid body at the start pos, set its velocity to the return of this, and it'll fly to the target.
It'll look a little artificial, though, without a tumble. I'll help you fix that too, though. Give the thrown object a script like this, and it'll torque itself up to a nice tumble. Set the timeout to about a second or less, or it'll go crazy, but that'll get you a pretty natural looking toss every time, that's always on target.
Enjoy!