Skip to main content
16 votes

most efficient AABB vs Ray collision algorithms

I'm surprised to see that no one has mentioned the branchless slab method by Tavian ...
Tyron's user avatar
  • 213
6 votes
Accepted

AABB to AABB collision response

There are continuous and discrete physics/mechanics. I do not know which one you are doing. Their main difference is in the detection, which you already have done. Thus, I will skip finding candidate ...
Theraot's user avatar
  • 27.2k
5 votes

Collision between AABB and Circle

To detect collisions between a circle and an AABB, you should find the closest point from the AABB to the circle. You can run the below code snippet and try to move the purple point which represents ...
Ghoster's user avatar
  • 51
5 votes

Collision between AABB and Circle

I've been thinking about this problem for a long time and looked at some of the answers here and on other forums. I came up with the following idea: Suppose the circle has radius ...
Jack Ding's user avatar
5 votes
Accepted

How do I implement a AABB-Sphere collision

I'm not sure how your storing your collision data or what language your working with but it looks like your trying to compare the distance from the center of your AABB to the center of your sphere. Is ...
DrewAtWork's user avatar
4 votes
Accepted

Getting the bounding box of a sphere

Calculating the bounding box of a sphere is pretty trivial given the simplicity of sphere geometry. Let's assume we have the radius of the sphere defined as a scalar (float or integer) value \$r\$, ...
doppelgreener's user avatar
4 votes
Accepted

Array-based tilemaps and bounding box (aabb?), how to do efficient tile collisions?

The reason there isn't a standard AABB or partition strategy for tile-based maps is that it's already easier to detect collisions against it than using AABBs. ...
Jimmy's user avatar
  • 9,029
4 votes

Swept AABB Collision Detection Conflict with Tile-sized Gaps

Since you have a tiled world and an exactly tile-sized character, a first step to sort out this problem can be to recognize when the character aligns with a tile. In the falling-into-a-hole case, this ...
Kevin Reid's user avatar
  • 5,498
2 votes

AABB vs Rectangle

Speaking to the naming part, left/right up/down are avoided because they are expressions of relative direction, whereas AABB's are concerned with operations which are rotationally invariant. For ...
Colin Wade's user avatar
2 votes

most efficient AABB vs Ray collision algorithms

I recently achieved over 61 billion ray/box intersections per second using AVX2 on a Threadripper 3960X (~2 billion single-threaded, ~1.9 cycles per box): https://tavianator.com/2022/ray_box_boundary....
Tavian Barnes's user avatar
2 votes
Accepted

How to get the center position for AABB of rotated mesh right?

According to this tutorial, the vector you are transforming should be the right-hand operand in the matrix multiplication expression, when using glm. Having it on the left will cause your vector to be ...
Colin Wade's user avatar
2 votes

How do I test if an AABB and concave polygon intersect?

If your game starts with the player AABB completely outside of the concave polygon, then I would solve an easier problem: Test the edges (line segments) of the polygon against the AABB. If you have ...
Bram's user avatar
  • 3,719
2 votes
Accepted

Could triangles be used for swept-AABB checks between positions?

Yes, your technique would work. It looks like a certain implementation of the convex hull technique, where you construct a convex hull describing the movement, and detect collisions by checking the ...
congusbongus's user avatar
  • 14.8k
2 votes

Benefits of going full AABB?

The main advantage is speed. Testing whether 2 AABB collide with each other requires 2 compares per axis. The test itself is really simple (...
ratchet freak's user avatar
2 votes

AABB test does not consistently detect edge-to-edge contact when bounds are very different in size

This sounds like floating point precision error when testing for exact equality. Let's model this in decimal to make it easier to read. Let's say we're using a decimal floating point format with room ...
DMGregory's user avatar
  • 135k
2 votes

How do Axis-Aligned Bounding Boxes update with rotations?

Given an original axis-aligned bounding box and a transformation matrix, you can compute a new axis-aligned bounding box from the extents of the original box, transformed by the matrix, like so: <...
DMGregory's user avatar
  • 135k
2 votes
Accepted

SAP method freezes

Everytime you get to the end of this loop: for(int j = 1; j < axis.size();j++) { you add to the axis: ...
Pikalek's user avatar
  • 12.4k
2 votes

How can I check if the mouse hits a quad in 3d, and where it hits it?

This is not a full answer, but these are the general steps to go through to get what you want Create a mouse-viewport ray, this is a line segment that starts from the camera eye position and shoots ...
Jay's user avatar
  • 810
2 votes

2D AABB Collision

Collision detection in games comprises of the following phases: Broad phase (which we will not go into here) culling. Narrow phase (which you have implemented) detection. Collision feature ...
Ian Young's user avatar
  • 2,649
2 votes

AABB Collision Detection Confusion

There's actually a third option: storing AABBs as mins and maxs. That is, a Vector2 as the minimum x and minimum y, and another as the maximum x and maximum y values that the AABB occupies. This ...
Casey's user avatar
  • 2,045
2 votes
Accepted

3D line segment AABB collision, with hit normal?

but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB Most of these ray intersection algorithms return the hit distance. All you need to do is check that ...
Krupip's user avatar
  • 1,763
2 votes
Accepted

Categorize contact & overlap cases for 2D & 3D axis-aligned bounding boxes

For each axis, compute whether the intervals spanned by the two boxes are...  -1: overlapped (minA < maxB & maxA > minB)   0: adjacent (minA == maxB or minB == maxA) +1: ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

Swept AABB Collision Detection Conflict with Tile-sized Gaps

After countless hours of finding the problem through trial and error and asking around on Discord servers and, of course, here, my friend and I found a very versatile solution for a particularly ...
Alan Rostem's user avatar
1 vote

Can't get AABB Collision to work properly

Sorry finally figured it out, heres my code just in case anyone else needs help ...
Jersh's user avatar
  • 21
1 vote

SAP method freezes

My suggestion to you is to place break points in your code to determine what is making your application freeze, I do however, get the feeling that you might be iterating through your loop incorrectly. ...
Mathew O'Dwyer's user avatar
1 vote
Accepted

How do I determine which voxels to test for collision against the player?

This post is a bit old, but it got bumped, so I'll followup with the solution I implemented. I used the players velocity (multiplied by the framerate) to compute a simple 3D cartesian range of voxels ...
Mr. Smith's user avatar
  • 813
1 vote

How do I determine which voxels to test for collision against the player?

First of all, minkowski sum is overkill for this, since the blocks are static. Go a bit simpler and use swept AABB. Secondly if you can, break the world into chunks, then only check blocks inside ...
Bálint's user avatar
  • 14.9k

Only top scored, non community-wiki answers of a minimum length are eligible