Wednesday 15 September 2010

android - AndEngine: collision between shapes -


When checking a collision of size with orangeine, I usually use it:

  // set the new position for mySecondShape.setPosition (mySecondShape.getX () + x, mySecondShape.getY () + y); // Check to see if (with myFirstShape.collides (mySecondShape))   

I want to know if two sizes will collide before setting a new position, such as: < Pre> if (with myFirstShape.collides (mySecondShape, addToX, addToY))

Is such a method present? Thanks for reading

No, I do not think there is such a way.

You can:

  • Create a dummy shape - the same size and everything but invisible. Then, you can move this dummy and check the collision before moving on to the real size.
  • If you react to the correct collision after moving the shape, then it should not be a problem - AndEngine shapes while executing your code (if it runs on UpdateThread).

No comments:

Post a Comment