collision-detection

Pixel Perfect Collision Detection in Cocos2dx

℡╲_俬逩灬. 提交于 2020-08-01 08:16:48
问题 I am trying to port the pixel perfect collision detection in Cocos2d-x the original version was made for Cocos2D and can be found here: http://www.cocos2d-iphone.org/forums/topic/pixel-perfect-collision-detection-using-color-blending/ Here is my code for the Cocos2d-x version bool CollisionDetection::areTheSpritesColliding(cocos2d::CCSprite *spr1, cocos2d::CCSprite *spr2, bool pp, CCRenderTexture* _rt) { bool isColliding = false; CCRect intersection; CCRect r1 = spr1->boundingBox(); CCRect r2

How to detect when rotated rectangles are colliding each other

只愿长相守 提交于 2020-07-03 13:00:47
问题 After saw this question many times and replied with an old (an not usable) code I decide to redo everything and post about it. Rectangles are defined by: center : x and y for his position (remember that 0;0 is TOP Left, so Y go down) size : x and y for his size angle for his rotation (in deg, 0 deg is following axis OX and turn clockwise) The goal is to know if 2 rectangles are colliding or not. 回答1: Will use Javascript in order to demo this (and also provide code) but I can be done on every

Cone to box collision

假装没事ソ 提交于 2020-06-16 17:27:10
问题 I'm looking to implement collision detection between a cone (With a round bottom. So it's basically a slice of a sphere) and a box. I'm not too fussed about it being AABB or OBB because transforming should be simple enough. Every solution I find uses a triangular cone but my cone is more of an "arc" that has an angle and distance. Is there a simple solution to doing this collision detection? Or is it a case of doing several types of tests? ie. something like getting intersection points on a

Cone to box collision

[亡魂溺海] 提交于 2020-06-16 17:25:28
问题 I'm looking to implement collision detection between a cone (With a round bottom. So it's basically a slice of a sphere) and a box. I'm not too fussed about it being AABB or OBB because transforming should be simple enough. Every solution I find uses a triangular cone but my cone is more of an "arc" that has an angle and distance. Is there a simple solution to doing this collision detection? Or is it a case of doing several types of tests? ie. something like getting intersection points on a