I have a small trouble with my collsion detection system, ill show it on images. im checking the detection by using that logic with example when moving to the right:
obj.x+obj.w+obj.mov > block.x
obj.x+obj.w+obj.mov < block.x+block.w
and
(
obj.y <= block.y
obj.y+obj.h >= block.y
or
obj.y <= block.y+block.h
obj.y+obj.h >= block.y+block.h
)
when object size and block size are equal, the problem appears
the 3 blocks are detected
1 = is the trouble maker
2 = isnt making much problem, since its on same axis
3 = is working
the 1 block is detected since its within Y + H area of the block (
it happens when the object is sticked with 0 pixel distance.
im using motion based on min(mov,dist) [dist is Y distance between object and block] function and when it tries to move to the right, it gets moved like that
because min(mov,dist) will become negative when getting distance to object 1 instead of 3, making it buggy
im asking if its possible to prevent block 1 (block 2 optionaly) when that situation happens. (or atleast change the logic)