Blog Mathematics
This blog will be about how I used math to calculate where the wine bottles would land in my project and how I could have improved on it. So right now I’m using guessing what force I need for the bottles to land on the right spot. I have the range the bottle needs to travel by taking the vector3 of the spawn position of the bottle and the position of where the circle is subtracting them.
var toSpawnDiff = spawnPos — transform.position;
Then I’m adding velocity to the wine bottle’s rigidbody.
winerb.velocity = new Vector3(toSpawnDiff.x * forwardForce, upSpeed, toSpawnDiff.z * forwardForce);
The forward force is what’s moves the bottle forward in a horizontal direction.
The upSpeed just moves the bottle up and doesn’t affect how far the bottle will move horizontally at all except for it making the bottle not touching the ground which causes it to slow down.
Right now I’m just guessing the forward force and upSpeed until I get it right instead of being able to just write a force and it will always land on the circle.
So what I need to do for that to work is.

I just need to pick a suitable angle (not an angle that pushes the bottle right on the ground).
I already have the range because I know where I want the bottle to land.
Then I need to calculate the velocity I need for it to hit the target.
I will do this by taking myRange *TheGravity/ sin(2*the angle I selected).
This will give me a velocity I now need to convert this velocity to one x velocity and one y velocity.
I will get the x velocity by doing this myVelocity *cosMyangle.
I will get the y velocity by doing this myVelocity *sinMyangle.
Now I always have a working force for both Y and X that will make my bottles land on the circle.
The only thing I need to do now is to add it to the rigidbody.
winerb.velocity = new Vector3(toSpawnDiff.x * forwardForce, upSpeed, toSpawnDiff.z * forwardForce);
References
Wikipedia. (2016). Projectile motion. [online] Available at: https://en.wikipedia.org/wiki/Projectile_motion#Parabolic_equation [Accessed 25 Aug. 2016].
Dot Physics. (2016). Basics: Projectile Motion. [online] Available at: http://scienceblogs.com/dotphysics/2008/09/05/basics-projectile-motion/ [Accessed 25 Aug. 2016].
Www2.southeastern.edu. (2016). Projectile Motion 2. [online] Available at: https://www2.southeastern.edu/Academics/Faculty/rallain/plab193/page1/page32/page32.html [Accessed 25 Aug. 2016].