i am trying to detect collision of two
CCSprite's, a ball (
PlayFigureSprite) and something that boosts that ball in a specific direction (
[Insert picture here showing two
BoostSprite's and one
PlayFigureSprite with their collision boundingboxes.
BoostSprite (right one) is rotated to the bottom right and it's boundingbox is bigger than itself.
BoostSprite has a boundingbox that perfectly fits it size because it's not rotated.
Backgroundcolor of picture is blue.]
Sadly i cant add a picture because of this message: "You have to be around for a little while longer before you can post links."
For debugging reasons i used
CCDrawNode to show the
BoundingBoxTransformedToParent of the
To detect the collision i use following code:
Everything works fine. The only problem is the collision detection when the
BoostSprite is rotated.
BoostSprite's have a bigger
BoundingBoxTransformedToParent than their actual size because the
BoundingBoxTransformedToParent is not rotated when the sprite was rotated.
In the picture above the ball would be accelerated to the bottom right if it hits the blue area next to the
BoostSprite (right one) which is unwanted behaviour. The ball should only be affected by the boost if it really hits the drawn
BoostSprite. For the left
BoostSprite it works perfect.
I couldn't find a way to rotate that boundingbox or create a boundingpolygon around
CCSprite's for better approximation (could also be useful for round objects like the ball).
How can I create an almost exact collision detection between two
CCSprite's (return only
true if the considered
CCSprite's REALLY overlap/collide) ?