What's the best way to get the x and y value of the point where two objects overlap? Or is this possible? Like a point of collision type thing.
be more specific, which types of object intersects: line/line, line/circle, circle/circle, line/convex polygon intersection...
Line/line.
This is pretty tricky. Let me see if I can work something out...
Develop games in your browser. Powerful, performant & highly capable.
Hooray, I just did a math!
Here you are, sir!
Awesome! Thanks! <img src="smileys/smiley1.gif" border="0" align="middle" />
here's another solution which counts line segments (not "infinite" lines)so line segments intersect not only because they are not parallel..
line-line intersection
edit: drag line end points
I would think that self.x< object2.x ?self.x+(distance(self.x,self.y, object2.x,object2.y)/2) :self.x-(distance(self.x,self.y, object2.x,object2.y)/2) would work.
Since distance() is based on the hotspots.
newt, not sure what you're getting at there. I'm interested...
The distance() between two points divided by 2, will give you a radius that you can use to get that x.
That is if both objects are of the same width, and height.
sqiddster could you re-seed the link to the example you provided in this post? :D
I'm looking for a simple as posible way to achieve this (I opened a topic)
Sargas try this.
sqiddster oh, that's awesome man, think it will work :3