Open co0p opened 2 years ago
turns out AABB is not sufficient when 2d objects can rotate ... see https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect and for more details:
test cases:
Example on how to do the math with points and rotate matrix... https://math.stackexchange.com/questions/126967/rotating-a-rectangle-via-a-rotation-matrix
@jevbelikov see https://github.com/brotherhood-of-recursive-descent/tankism/blob/master/lib/collision/collision_test.go for the first test on collision AABB style
Maybe helps: To get Rx(\theta) in right-handed coordinate system, replace the angle \theta with negative \theta. Then apply the following rules.
cos(-\theta) = cos\theta sin(-\theta) = -sin\theta
currently objects move through each other. There should be a basic collision detection system, that reacts when there was a collision detected
AABB: https://github.com/co0p/foodzy/blob/c9a8a145f264da217b0a9af2f48d588e712c8418/collisionSystem.go#L71