N game tutorial collision detection convex/concave?

That's a simple sphere-vs-sphere collision. See the part where they do var pen = len - rad; if(0 Xw)) - (obj.pos. X - (signx*obj.

Xw));//(ox,oy) is the vector form the innermost AABB corner to the var oy = (t.pos. Y + (signy*t. Yw))- (obj.pos.

Y - (signy*obj. Yw));//circle's center They are moving the "t" object to "obj" frame of reference.

That's a simple sphere-vs-sphere collision. See the part where they do var pen = len - rad; if(0 X + (signx*t. Xw)) - (obj.pos.

X - (signx*obj. Xw));//(ox,oy) is the vector form the innermost AABB corner to the var oy = (t.pos. Y + (signy*t.

Yw))- (obj.pos. Y - (signy*obj. Yw));//circle's center They are moving the "t" object to "obj" frame of reference.

SyntaxT3rr0r: It's a tutorial pal, no need to point out its pitfalls (in the long run Anandh will probably find out he can used radiuses squared). – Chiguireitor Jun 20 at 16:55 If they are checking the radius (distance between center of two object == sum radius of two object) , my question is how are able to use this approach to find the collision between one sided curved shape "please refer to - Figure 6". – Anandh Jun 20 at 18:21 1 They collide both objects as if they were two spheres.

The rectangle "sphere" is the imaginary "sphere" from the center to the corner, if there's an intersection of both spheres they check that the distance between the rectangle's corner and the concave radius is near enough to collide. To rule out the corner of the concave object, if the rectangle's sphere radius is > len then len - rad will be less than 0 and no collision will be made :) – Chiguireitor Jun 21 at 1:53 now I understood the code along with your description , now am curious to know what is wrong with this collision code. One more question is how perform collision detection on curved surface (like Locoroco game worlk)?

– Anandh Jun 21 at 14:43 @Anandh : The bad things on this code are: 1) extensive use of Math. Sqrt, you could use everything squared and voila; and 2) The signx*obj. Xw you could use a conditional sign change on a local var, less expensive that a multiplication.

Take into account that these "bad things" are only bad if you're using this code to collide thousands of objects or if your code is going to run on a mobile platform (computing power drains battery faster). – Chiguireitor Jun 21 at 15:48.

That's a simple sphere-vs-sphere collision. See the part where they do.

I think it would be much better to show the underlying physical algorithm, then you can understand code faster.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions