Jump to content

  • Log In with Google      Sign In   
  • Create Account

Pixel perfect collision and concave shapes in 2D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 l4mbda   Members   -  Reputation: 104

Like
0Likes
Like

Posted 26 September 2012 - 08:43 AM

Hi everyone,
I hope you can help me.

I'm working on a concept of pixel perfect collision in a 2D enviroment combinied with some physic simulations.

My problem comes by handling a collision correctly. For example, my object wants to move in an area it mustn't, I recalculate the velocity and bring it as close as it is alowed to the "edge". Now, for my purposes, the object must react to any kind of shapes. and even if it's only one backgruound pixel. So, I check both, the background and also the objects bitfield for overlap. And while this all works pretty nice on "straight line egdes", I often encoure problems whene I hit a concave shape.

I know what the problem is: No matter how round a shape is, at the end it's all about suqare pixels. That's the first thing I can't simulate. Then, when I hit pixel and recalculate the velocity, in the next frame my object often hits a Pixel next to the first collisons pixel. In the real world, the object would just "roll over" this pixel by its mass, but in my concept, it just calculates the velocity new and sends it in the moste cases back to the first collision, which concludes amlmost everytime in a situation, where my object gets stuck in a round shape.

I tried alot of things, but nothing got me any closer to a smooth collision handling in concave curves.

Has anyone any suggestions?

Thanks in advance.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS