andreww
03-12-2002, 03:28 PM
Is there an API command to check if two regions are touching??
ie there are two regions and they are overlapping...
ie there are two regions and they are overlapping...
Is there an API command to check if two regions are touching??andreww 03-12-2002, 03:28 PM Is there an API command to check if two regions are touching?? ie there are two regions and they are overlapping... Squirm 03-12-2002, 03:42 PM No, but you can be clever ;) Lets say we have 2 objects defined by Region A and Region B Use GetRgnBox to grab RECTs for each region IntersectRect the 2 rectangles. If they dont intersect then finish, they do not collide If they do intersect then: Use CombineRgn on A and B with the XOR flag, and store it (call it Region Z for now) Use CombineRgn on A and B with the OR flag, and store it (call it Region X) Use EqualRgn on Regions X and Z to see if they are identical. If they are identical, then the regions are not touching. However, if they prove to be different, then a collision has occured :) andreww 03-12-2002, 03:57 PM so is this what region x and z would look like? ChiefRedBull 03-12-2002, 04:05 PM Thats what they'd look like? I don't get it.... :confused: Btw, nice idea Squirmy! :) andreww 03-12-2002, 04:06 PM yes Squirm 03-12-2002, 04:33 PM Correct, andrew. And because they are different, it means the regions are touching. :) Squirm 03-12-2002, 04:35 PM Note: the use of regions is pointless if they are all rectangular, in that case use RECTs instead. andreww 03-23-2002, 06:12 PM ok here my program, i cant get your collision detection working for some reason squirm BillSoo 03-23-2002, 07:12 PM If one of the regions is rectangular, you could use the RectInRgn API function.... andreww 03-24-2002, 05:38 AM the regions points are every where so not like a rectangle heres an update of my program im trying to make 2 new regions by combining the ship rgn and the terrain rgn, and the i am tryin to fill them in with colour so i could see them and also if the ship moves into the land it to output some text in the me.caption but nothing is happening so heres the game |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum