# Tag Info

Accepted

### How can I detect the player being crushed in a 2D platformer?

I think you'll have to take the box's movement into consideration. That is, only crush if the box is moving towards the player. This is similar to other problems in platformers, where the movement is ...
• 14.8k
Accepted

### Solving obtuse interior corner collisions

There is an alternate way to think about solving this. You can do a transform by offseting the lines by radius of your circle then the solution is same as intersection of 2 lines. Image 1: You can ...
• 399

### Solving obtuse interior corner collisions

I assume that you want a solution for collisions in general, which also works well for interior corners. When resolving a collision against one plane, do not move the circle perpendicular to the plane....
• 5,508

### How can I detect the player being crushed in a 2D platformer?

Have the "crush test" points be inside the gray box shown in your image #1 - i.e. kill the player only if you detect a hit on one of the pixels there.
• 1,019

### How can I detect the player being crushed in a 2D platformer?

As someone who grew up with 80s platformers, my first comment is that the contact points must be exactly on the sprite, not anywhere outside it. There were few experiences more frustrating than dying ...
• 222
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 ...
• 27.2k
Accepted

### How do I apply angular velocity vector after a collision?

The angular velocity vector you've computed using the method you've shown gives you two things: The direction the vector points is the axis of rotation The magnitude of the vector is the speed of ...
• 135k

### 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 ...
• 51

### 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 ...
Accepted

### Calculate bounce and friction after a projection-based collision

The "velocity vector" is the difference between the velocities of the two objects. When colliding with a static (unmoving) object (such as the level), the "velocity vector" is indeed its current ...
• 2,470
Accepted

### Finding the contact point of two spheres

This is probably the simplest 3D collision check. Distance between sphere centers is length(c1.center - c2.center) Depth is distance - radius1 - radius2 = ...
• 9,029
Accepted

### Is there a generic formula to determine the angle of deflection off of a rectangle?

The edges of your rectangle are just straight lines, so the angle of reflection is equal to the angle of incidence: Now, if this surface has its own angle, we can factor that in. Call the angle of ...
• 126
Accepted

### Pattern for collision handling?

Well, as some kind of solution I may suggest that in your case you should use something called Double Dispatch: the pattern Visitor actually. Let's look at your example briefly: If the player and a ...
• 411

### 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 ...
• 5,508

### Solving obtuse interior corner collisions

To find the position where the circle is resting against both planes, you could use following approach: We define the line k which is the bisector of the angle between g and h. Every point on line k ...

### How to handle collision detection & response in voxel engine with slopes?

There is a fairly simple way to do collision detection between a single "voxel shape" and an AABB. It relies on the SAT (separating axis theorem) - finding a plane which separates both objects. As ...
• 467

### Adding collisions to a 3D mmorpg game

You need to keep splitting your world into little parts. There are plenty ways of handling collisions between a height map and objects, but in the end, every method has the same problem; The Amount. ...
• 317
Accepted

### Strategies for dealing with crowds at choke-points

Assign each movable object a unique index & prohibit an object with a higher index from moving an agent with a lower index. This will allow 'older' objects to nudge 'newer' ones, but not vice ...
• 12.4k

### Resolving Circle-Circle collision

Let's say the moving circle $A$ has radius $r_A$, starts at position $\vec p_A$, and travels with velocity $\vec v$ And let's say the stationary circle $B$ has radius $r_B$ and ...
• 135k

### Detect collision point

In 2D rarely you have only one point of contact. I never played with collision resolution in 3D, but i guess this case will be even more rare. As for the answer, take a look at Erin Catto's (creator ...
• 361
Accepted

### Measure force of an impact to deal damage

This is commonly done with collision.relativeVelocity, something like this: ...
• 135k

### What to do with collision detection?

This problem of "I found a collision/overlap, now what do I do about it?" is called collision-resolution. There are lots of different ways that games handle this, roughly in order of ...
• 135k
Accepted

### Rectangle collision not working!

We can make this a bit simpler using Minkowski addition. We can shrink one rectangle down to its center point, and enlarge the other rectangle from its center by the first's width and height, and get ...
• 135k

### Rectangle collision not working!

Preface The answer from @DMGregory has some wonderful math that will most likely solve most if not all of your problems. While I would recommend working towards an implementation like theirs, I ...
• 181
Accepted

### Find closest open space in grid of rectangles?

I did some tests and found that this method does work. First you need to find the nearest grid coordinates to the position of the dragged block (blue box). Then do a grid-based BFS on the target ...
• 2,616

### How do I make soft tile-based collision?

You mentioned a list of goals you want to achieve. In my opinion, they cannot be achieved using a single out-of-the-box way. You can unify them by wrapping the existing physics engine, But each effect ...
• 2,616

### Bouncing balls miss collisions, bounce the wrong direction, of lose momentum on one axis when hitting a corner

It appears that your code is fighting with the physics engine about who gets to control the velocity vectors of the balls. When there is a collision between two rigidbodies, then the Unity physics ...
• 120k
Accepted

### Do two balls of different mass bounce different heights?

The answer to your question is: no, as long as the system you're referring to implies no friction, there are no external forces, and the material the two ball are made of can be ignored. In Classical ...
• 4,866