1
\$\begingroup\$

I am trying to make a collision between a sprite and an animated sprite. The animated sprite is the main character of the game. The problem I am facing is that when another sprite collides with the main character, it collides with the transparent bounding area around the character. How should I perform collision detection between the actual pixels of the character and any other obstacle sprite?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I read somewhere that when working with the PhysicsBox2DExtension, you can create a Body that has the outline of your actual Sprite content. Can someone guide me on how to do so? \$\endgroup\$ Commented Jul 12, 2012 at 6:06
  • \$\begingroup\$ possible duplicate of How do I detect pixel-level collision using andEngine? \$\endgroup\$
    – House
    Commented Jul 12, 2012 at 13:04

2 Answers 2

2
\$\begingroup\$

If your game need real world collision detection then you have to use box2d provided by andengine then after you do not have to worry about the collision. Because body for your different shapes have been created.

EDIT : For the purpose of pixel perfect collision detection the following link can help you that I think.

http://qwerjk.com/pixel-perfect/

In which they show demo and also provide example.

\$\endgroup\$
3
  • \$\begingroup\$ -1. That doesn't answer the question. Box2D provides collision-detection (you could even use only the collision-detection part and skip the physics-simulation entirely), but it doesn't do pixel-perfect collision detection, which is what was asked for. \$\endgroup\$
    – bummzack
    Commented Jul 14, 2012 at 8:12
  • \$\begingroup\$ that -1 is not fair... is a good answer... in general, pixel perfect collision for a game is a bad idea, is far better using several boxes or circles to improve perfomance, to know with part of the body collides, etc... and if you are using a engine that provide it... it should be used \$\endgroup\$
    – Blau
    Commented Jul 21, 2012 at 9:16
  • \$\begingroup\$ Removed the downvote, as the answer was improved. \$\endgroup\$
    – bummzack
    Commented Jul 21, 2012 at 9:30
2
\$\begingroup\$

AndEngine Collision Extension: https://github.com/MakersF/AndEngineCollisionsExtension This is an extension that aims to bring different collision methods (perfect or approximations) to AndEngine GLES2

Supported Collision Methods: Pixel-Perfect Collision (supports: translation, scale, rotation, screw) It also support pixel-perfect collision between pixel-perfect shapes and retangular shapes, without the need for the latter to be a pixel-perfect shape. Alpha values different from 0 (you set the threshold that identify if a pixel is solid or not) You ca unse the utils methods to check the performances in your app or to output the collision mask to check if it is what you need

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .