The determination of whether or not two or more entities make contact with each other during gameplay.

learn more… | top users | synonyms (2)

114
votes
9answers
21k views

How was collision detection handled in The Legend of Zelda: A Link to the Past?

I would like to know how the collision detection was done in The Legend of Zelda: A Link To The Past. The game is 16x16 tile based, so how did they do the tiles where only a quarter or half of the ...
53
votes
9answers
4k views

How to avoid circular dependencies between Player and World?

I'm working on a 2D game where you can move up, down, left and right. I have essentially two game logic objects: Player: Has a position relative to the world World: Draws the map and the player So ...
45
votes
7answers
5k views

2D Platformer AABB collision problems

I have a problem with AABB collision resolution. I resolve AABB intersection by resolving the X axis first, then the Y axis. This is done to prevent this bug: http://i.stack.imgur.com/NLg4j.png ...
33
votes
6answers
7k views

How does a collision engine work?

How exactly does a collision engine work? This is an extremely broad question. What code keeps things bouncing against each other, what code makes the player walk into a wall instead of walk through ...
31
votes
3answers
2k views

A ball hits the corner, where will it deflect?

I need to brush up my trigonometry and hope you can help here with a simple mathematical model. Here is my model so far in the image attached. I am aware that the frame animation has other problems ...
27
votes
9answers
21k views

What is the fastest way to work out 2D bounding box intersection?

Assume that each Box object has the properties x, y, width, height and have their origin at their center, and that neither the objects nor the bounding boxes rotate.
27
votes
6answers
2k views

Hexagon collision detection for fast moving objects?

A object has a position and a speed vector. Usually only the position is used to check if two objects collide, this is problematic for very fast moving objects as it can happen that the object moves ...
23
votes
8answers
1k views

Is there a simple way to stop enemies standing in the same spot?

So: top-down game, my enemies chase the player, when they get within a certain distance they stand still and fire. If they're all coming from the same direction they all end up standing in the same ...
23
votes
7answers
13k views

most efficient AABB vs Ray collision algorithms

Is there a known 'most efficient' algorithm for AABB vs Ray collision detection? I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly ...
22
votes
4answers
2k views

Momentum and order of update problems in my physics engine

This question is a "follow-up" question from my previous one, regarding collision detection and resolution, which you can find here. If you don't want to read the previous question, here's a ...
22
votes
6answers
2k views

What is a good algorithm to detect collision between moving spheres?

If (for the purpose of collision detection) 3D objects are represented in a game by spheres, what is a good algorithm to detect a collision between spheres? If each object has a position as of the ...
19
votes
6answers
2k views

Collision 100% avoidance implementation

I'm an absolute beginner with game development and all I know about collision avoidance/resolution, I learnt it on or through this site in the past week... so don't hesitate to correct me if what I'm ...
18
votes
6answers
2k views

How to optimize the distance function?

While developing a reasonably simple RTS-like game, I noticed my distance calculations were causing an impact in performance. At all times, there are distance checks to know if a unit is in range to ...
18
votes
4answers
4k views

Should collision detection be done server-side or cooperatively between client/server?

I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist ...
17
votes
3answers
733 views

Building a Plattformer - How to determine if a player is allowed to jump?

I'm building a simple Plattformer Jump n' Run Style game. I do not use tiles - instead i've geometrical shapes for my level entities (and the player is one too). I finished my collision detection code ...
17
votes
4answers
3k views

How to deal with corner collisions in 2D?

I'm writing a top down 2d XNA game. Since its my first I'm trying to write the physics and collision stuff myself to learn it. Whenever my player sprite character attempts to move into a position ...
15
votes
2answers
1k views

Where should collision detection logic be placed?

I am developing a small 2D game engine. The characters have a paint method which currently does the following: Calculate the new position of the character as per its speed, etc. Update the collision ...
14
votes
2answers
3k views

How to find if circle and concave polygon intersect?

I have a polygon (sometimes convex, but often concave), and a bunch of circles with different radius. How can I find out if a circle is intersecting/overlapping with the polygon? If it makes it ...
14
votes
5answers
5k views

Collision Resolution

I know quite well how to check for collisions, but I don't know how to handle the collision in a good way. Simplified, if two objects collide I use some calculations to change the velocity direction. ...
14
votes
2answers
1k views

Best/Efficient way to implement a 3d Collision

I've already programmed a 2d based collision system for a previous game. It was my first collision system and it was ugly. I was looking for collision between objects by checking all objects with all ...
14
votes
1answer
710 views

How to resolve collisions of compound shapes using SAT?

SAT is a decent way to determine collisions between arbitrary convex polygons. You'll even get the vector that is needed to resolve a collision. To resolve collisions between complex (non-convex) ...
13
votes
4answers
1k views

Optimizing collision engine bottleneck

If this is your first time on this question, I suggest reading the pre-update part below first, then this part. Here's a synthesis of the problem, though: Basically, I have a collision detection ...
13
votes
1answer
6k views

Quad tree vs Grid based collision detection

I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard ...
13
votes
1answer
2k views

Quad trees/grid based collision - putting logic into action

First of all, I've only been writing my own game logic for a short while, so I apologize if this might seem straight forward. I've been reading a lot about quad trees and grid based collision ...
12
votes
6answers
3k views

How do I handle Isometric collision detection?

I would like to make an isometric run-jump style platformer. The player should be able to jump on top of platforms above the floor, hit the side of objects etc. I'll be using a 2D game engine so I ...
12
votes
5answers
3k views

2D Level design/editing/saving questions

I thought about making a simple 2D Sidescroller game like SuperMario. Then i wondered about how to save, load or create the levels for the game. The first thing i thought of was drawing a simple ...
12
votes
3answers
1k views

Resolving a collision with forces

In my 2D physics engine, I can detect AABB vs AABB collisions, and resolve them by finding the shortest penetration vector and adding it to the AABB's position. Doing this "pushes" the first AABB ...
12
votes
3answers
3k views

2D game collision response: SAT & minimum displacement along a given axis?

I'm trying to implement a collision system in a 2D game I'm making. The separating axis theorem (as described by metanet's collision tutorial) seems like an efficient and robust way of handling ...
12
votes
5answers
3k views

2D Rope Collision Detection

I'm wanting to create a rope that can collide with objects like in the following youtube video: 2D Game Physics Rope I'm thinking that you implement the verlet integration which uses points and ...
11
votes
2answers
11k views

Is there a good way to get pixel-perfect collision detection in XNA?

Is there a well-known way (or perhaps reusable bit of code) for pixel-perfect collision detection in XNA? I assume this would also use polygons (boxes/triangles/circles) for a first-pass, quick-test ...
11
votes
3answers
3k views

Faster 2D Collision detection

Recently I've been working on a fast-paced 2d shooter and I came across a mighty problem. Collision detection. Sure, it is working, but it is very slow. My goal is: Have lots of enemies on screen and ...
11
votes
3answers
3k views

Collision resolution in case of collision with multiple objects

I have static objects and movable objects. The collisions are detected using the separating-axis-theorem. For example, in this situation I have two static objects (in red): and a movable object ...
10
votes
1answer
3k views

How can I define a complex collision area on top of a tile map?

As many people recommended, I am using Tiled map editor to create a map for my game and it's great particularly because libgdx framework also provides with API for maps from Tiled. I understand I can ...
10
votes
3answers
446 views

How to implement collision detection of portals?

For example, take this scenario (excuse my horrible drawing skills): This is based on "Portal", where the stickman is going through the blue portal (which is linked to the red portal), but there is ...
10
votes
2answers
500 views

How do I make good guy attacks only hit bad guys and vice versa?

My game has many different type of good guys and many different type of bad guys. They will all be firing projectiles at each other but I don't want any accidental collateral damage to occur for ...
10
votes
3answers
409 views

Is showing a collision in slow motion computationally relaxing?

In a lot of racing games (Burnout Paradise, for example) when a collision is about to happen, the game play automatically switches to slow motion and carries on in slow sequence until after the ...
10
votes
2answers
1k views

Continuous Physics Engine's Collision Detection Techniques

I'm working on a purely continuous physics engine, and I need to choose algorithms for broad and narrow phase collision detection. "Purely continuous" means I never do intersection tests, but instead ...
9
votes
2answers
2k views

Isometric Collision Detection

I am having some issues with trying to detect collision of two isometric tile. I have tried plotting the lines between each point on the tile and then checking for line intercepts however that didn't ...
9
votes
1answer
3k views

Circle-Line Collision Detection Problem

I am currently developing a breakout clone and I have hit a roadblock in getting collision detection between a ball (circle) and a brick (convex polygon) working correctly. I am using a Circle-Line ...
9
votes
2answers
483 views

Boat passing under a bridge in a 2D tile based RTS

I'm writing a 2D tile based RTS. And I want to add a 'pseudo 3D' feature to it - bridges over the rivers. I havent't start any coding yet, just trying to think how it fits the collision detection ...
9
votes
4answers
1k views

Circle inside circle collision

In one of my projects I have a game area in the shape of a circle. Inside this circle another small circle is moving around. What I want to do is keep the small circle from moving outside the bigger ...
9
votes
3answers
2k views

FPS Collision detection and movement

How is collision detection and movement typically handled in a FPS, particularly handling slight changes in ground height such as stairs (both on incline and decline)?
9
votes
2answers
944 views

What is the best way to handle simultaneous collisions in a physics engine?

I'm writing a 2d physics engine in javascript so that I can learn more about physics in video games. I have it working correctly for rigid body collisions, except for if any body collides with two or ...
9
votes
4answers
4k views

2D Spatial partitioning alternatives to spatial hashes and quadtrees

I've been trying to implement a spatial partitioning algorithm in my game, but both spatial hashes and quadtrees aren't what I'm looking for. My level size is not supposed to have a limit (only Int32 ...
9
votes
4answers
900 views

What's the most efficient way to find the intersection point of a missile and a bitmap terrain?

Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if ...
9
votes
1answer
2k views

How to create a realistic 2D Role-Playing game collision detection?

I’ve always wanted to create an old-fashionned 2D Role-Playing Game like Star Ocean, Final Fantasy, Sword of Mana and even the “Tales of” series, and I guess a lot of people do. But before even ...
9
votes
2answers
269 views

Falling Blocks and complex shapes

I currently have a simple Tetris-like game and have come across a problem I cannot solve. Unlike Tetris where there is a single falling shape, I have multiple, potentially interlocking shapes that ...
9
votes
2answers
944 views

Simulating an object floating on water

I'm working on a top down fishing game. I want to implement some physics and collision detection regarding the boat moving around the lake. I would like for be able to implement thrust from either the ...
9
votes
4answers
1k views

Collision rectangle response

I'm having difficulties getting a moveable rectangle to collide with more than one rectangle. I'm using SFML and it has a handy function called intersects which takes 2 rectangles and returns the ...
9
votes
1answer
349 views

Deforming surfaces

I try to accomplish an deforming physic behaviour for levelsurfaces, but don't get an idea how to start with the implemenation so far. Regardless of the shape from the surface (planes, cubes, ...