# Tagged Questions

Collision detection is the determination of whether or not two or more entities make contact with each other during gameplay.

581 views

### Collision Detection/Response in Vector-based levels

I have a 2D side scroller whose levels are stored as vectors (that is, a bunch of lines) which looks like this: How would I detect that I'm colliding with one of these lines, and react accordingly (...
401 views

### Self colliding cloth physics

I've previously simulated cloth using Verlet integration but couldn't successfully get the cloth to collide with itself in an efficient way. The reason being is because I used a brute force algorithm ...
3k views

### How can I do fast Triangle/Square vs Triangle collision detection?

I have a game world where the objects are in a grid based environment with the following restrictions. All of the triangles are 45-90-45 triangles that are unit length. They can only rotate 90°. The ...
5k views

### Implementing Separating Axis Theorem (SAT) and Minimum Translation Vector (MTV)

I was following codezealot's tutorial on SAT and MTV and trying to implement it myself but I've come a cropper when it comes to getting the correct MTV. Here is my example: (Cue pretty pictures...) ...
979 views

### XNA Platformer Collision: PerPixel vs Rectangle

I'm writing a platformer engine with XNA and was wondering what method for handling collisions I should use. Would I be seeing some performance issues if I were to try and have PerPixel collisions? ...
200 views

### How to detect collision only in non-transparent texture?

I am developing a game using libgdx. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision. if(player.getBounds().overlaps(boundsBot)){ } ...
349 views

### Finding roots/zeros for collision detection?

For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori ...
463 views

### Collision Detection problems for vertically moving platforms

Background My game is a static screen (ie, no scrolling) 2d platformer and my CD routine is split into 2 - after vertical movements, (ie, gravity etc) I check for collisions, and if they are detected,...
918 views

### When to detect collisions in game loop

My game loop uses a fixed time step to do "physics" updates, say every 20 ms. In here I move objects. I draw frames as frequently as possible. I work out a value between 0 and 1 to represent the ...
4k views

### how get collision callback of two specific objects using bullet physics?

I have got problem implementing collision callback into my project. I would like to have detection between two specific objects. I have got normall collision but I want one object to stop or change ...
2k views

### Minecraft-style player-gound collision detection

The title pretty much says it all... (Minecraft is a game consisting of evenly-spaced cubes for terrain, like voxels) Note: I am using C# XNA. I am pretty sure AABB is the way to go, yet I don't know ...
970 views

### Need some advice regarding collision detection with the sprite changing its width and height

So I'm messing around with collision detection in my tile-based game and everything works fine and dandy using this method. However, now I am trying to implement sprite sheets so my character can have ...
1k views

### Correct order of operations in a platformer game loop

I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the ...
369 views

### Separating axis theorem with multiple polygons?

I am attempting to implement the separating axis theorem in C#. I have a function that can calculate the minimum translation vector between two polygons. However, I can't seem to create a function ...
369 views

### Rotating platform glitch in a 2D platformer [closed]

So I'm making a tiled platform game in C#/XNA where the whole world is constantly rotating. The huge hurdle was to find out what side of the tile the player was touching, and what angle it was. I ...
3k views

### 2D Collision detection for Pinball Game

So far in previous games I have used simple 2D collision with boxes then checking at pixel level for a collision. If making a pinball game in nearly a lot of frames the ball will be in contact with a ...
307 views

### detecting the coordinates where a bullet hits a mesh

I have a lot of complex objects in a scene and I'm looking for an efficient way to find which object a fired bullet hits, and to find the hit coordinates. It would be best if there was a lightweight ...
1k views

### How to calculate new direction after sprite collision

The scenario as you can see in the picture. A ball will be hitting a surface and I want to fairly correctly get the new angle after the collision.. I expect to know the X,Y coordinates of the lines ...
1k views

### Boundaries in game development: How do “professionals” do it?

How do professionals do boundaries in a 2D game? The way I do is say I don't want the sprite to move into a certain area: //Example if ((playerPosX >= 825) && (playerPosX <= 910)&&...
2k views

### How do I resolve a collision of a rectangle with two rectangular tiles at once?

I am having some problems with collision detection between a player and the environment in a tile-based game. I have a player objects, Tiles and what I call MapObjects. The tiles are all 16×16. The ...
682 views

### How to handle collisions without ugly conditionals and type checking?

(I asked a similar question, but this one is far more specific). How can I handle collisions without having to do a lot of type checking and if statements? People here suggested that when spotting a ...
7k views

### How can I use Rectangle.Intersect() to resolve collisions in XNA?

I have a 2D game written in XNA, and I've been trying to fine-tune my collision resolution. All of my game objects are squares, which means detecting a collision is easy - use the position and the ...
556 views

### Solving 2D Collision Detection Issues with Relative Velocities

Imagine you have a situation where two objects are moving parallel to one-another and are both within range to collide with a static wall, like this: => 20m/s => 40m/s +==========+ +======...
1k views

### Ellipsoid v. Box collision detection

I'm trying to write some collision detection code. ATM i have the code properly resolving Ellipsoid v. Ellipsoid collisions, and Box v. Box collisions, but Ellipsoid v. Box collisions doesnt work. ...
97 views

### Dealing with collisions across adjacent static bodies

The Problem: I have the following setup: A, B and C are rectangular static bodies in box2d. p is a circular dynamic body in box2d. The movement of 'p' is solely controlled by the current gravity ...
5k views

### How can I implement fast, accurate 2D collision detection?

I'm well aware of how to detect if two or more 2D objects collide but I'm interested in how to decide whether to check for a collision. In previous projects, I just had every object check against ...
2k views

### Make my NPC “see” gameobjects around him in Unity

I have a walking NPC that will "see" the wall in front or behind him (2d gameplay) and that will react accordingly. I was thinking to attach him to an invisible collider that would react to objects ...
278 views

### Get normal dependent on collisions position

As I hask ask here I'm working on how my objects can move over the terrain and other objects. My proposal and also an idea in the answers was to calculate the rotation from the object with the normals ...
401 views

### What's the reason behind collision-boxes?

I was surprised that some games use extra models called collision-boxes for collision. What is the benefit of doing so? Can't we calculate collisions between the vertices of any game model? Is this ...
1k views

### How to perform simple collision detection?

Imagine two squares sitting side by side, both level with the ground like so: A simple way to detect if one is hitting the other is to compare the location of each side. They are touching if all of ...
243 views

### Is there an equivalent of Unity's OnCollisionEnter() in UE4?

I've been looking for how to figure out when two objects are colliding all day. If anyone knows how to do it I would be grateful. What I really want is a similar function to Unity's OnCollisionEnter(...
298 views

### Roguelike 2D Collision Detection

I'm just a normal guy trying to do some basic collision detection but I suck at it. I either get stuck in a wall or I go in reverse in the wrong direction trying to update the player position to a non ...
255 views

### how to keep display tick rate steady when using continuous collision detection?

(I've just found about this forum). I hope it is ok to repost my question again here. I posted this question at stackoverflow, but it looks like I might get better help here. Here is the question: I'...
3k views

### Circle-Rectangle collision in a tile map game

I am making a 2D tile map based putt-putt game. I have collision detection working between the ball and the walls of the map, although when the ball collides at the meeting point between 2 tiles I ...
1k views

### 2D Collision: Check before or check after?

I'm using velocity to move my character, I just add/subtract 0.4f and then update the players position in the update loop. I was wondering, when would be the best place to check for collision? Do I ...
8k views

### 2D Platformer Collisions

I've basically asked this question before, and I know it's been asked probably a billion times, but I still can't seem to do it. All I want to know is how I should go about doing basic 4-way, ...
1k views

### Tile based collision detection failing when player is going too fast

I'm creating a side scroller and I'm have a problem with my collision detection. The collision detection works perfect when the player is falling at a constant speed, but when I implement more ...
2k views

### How do collision meshes work in games like Zelda on the N64?

I was recently reading about the technology of Ocarina of Time/Majoras Mask and discovered that world collision is done using a single triangle mesh (vertices, normals, etc) for an entire area. There ...
2k views

### Best system for creating a 2d racing track

I am working a 2D racing game and I'm trying to figure out what is the best way to define the track. At the very least, I need to be able to create a closed circuit with any amount of turns at any ...
894 views

### How can I normalize a vector if I am handling movment of each axis seperatley?

I am writing a 2D tile based game engine in XNA, and I've recently fine-tuned my collision detection using the answers provided here and more specifically here. The tile based collision detection now ...
392 views

### How do I find actors in an area on a poly-precise basis?

Ok, I've been asking various questions and getting some good answers, but I think I need to rethink my method, so I'll describe the problem. I have a player who has a big blue box in front of him. ...
419 views

### Multiple Colliders in Collision

I have an object that has a front collider, left collider and right collider. When a collision occurs, I notice that there are situations where the front collider and left collider/right collider has ...
4k views

### Finding if a point is inside of a mesh (Point-in-polyhedron)

How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, -Z)...
556 views

### How to detect collision with non-rectangular objects in 2D games?

Detecting collision with rectangular objects is quite easy. I am able to write simple tile based games. Now I want to learn to write non-tile based games in which objects may not be rectangular, for ...
5k views

### How can I set up a Pong-style game using the physics system in Unity?

I've just been using Unity and chose to learn it by making a Pong game which sounded simple enough as a "hello world" type of game. My goal was to try and encompass enough of the built in engine ...
1k views

### Determining if a character is within the field of view in XNA

I'm trying to creating a field of view for the camera I'm making for a game. It rotates around a circle for 180 degrees while the head moves accordingly. I'm going to bound the field of view within an ...
1k views

### Android collision detection of a 3d object based on a 2d projection

I am writing a game for android. We have an orthographic view setup, but the characters (ships, projectiles, etc). The enemies / characters will be able to rotate about the x axis. The problem is that ...
1k views

### 2D collision-detection middleware

(This question was split off from http://gamedev.stackexchange.com/questions/3345/) Are there any recommendable middleware available for 2D collision detection? I believe I've heard that Box2D could ...