Consider this.
I've based this on this article, which I only understand somewhat.
http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/To check collision between two spheres, I calculate the distance between the two centers of those spheres. If that distance is smaller than the sum of the radiuses plus the velocity of the objects (r + r + xs), collision = true.
My question is about collision with the ground. I have an array with x&y locations for the ground. I know the position of
a, I know the position of
b, I know the length of
r, I know the velocity of the object along the vector, so I know point
c too.
How do I check if
b,c intersects with
d,e? I've read about the dot product, but I don't really understand how I would implement that. I'm fairly new to vectors, and I hope someone here can help me.
Cheers.