The determination of whether or not two or more entities make contact with each other during gameplay.
99
votes
6answers
15k 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 ...
50
votes
8answers
3k 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 ...
43
votes
7answers
3k 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
...
28
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 ...
22
votes
10answers
9k 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.
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 ...
21
votes
8answers
853 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 ...
20
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
1k 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
4k 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 ...
18
votes
7answers
7k 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 ...
17
votes
3answers
693 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 ...
16
votes
4answers
2k 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 ...
16
votes
4answers
2k 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 ...
14
votes
5answers
4k 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
1answer
548 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
2answers
2k 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 ...
13
votes
2answers
922 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 ...
13
votes
1answer
5k 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
2answers
723 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 ...
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
3answers
607 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
2k 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 ...
11
votes
1answer
1k 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 ...
11
votes
5answers
2k 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 ...
10
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 ...
10
votes
3answers
334 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
1answer
2k 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
386 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 ...
9
votes
2answers
371 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
742 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
2answers
977 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 ...
9
votes
3answers
1k 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
4answers
197 views
+200
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 ...
9
votes
2answers
759 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
1answer
250 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, ...
9
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 ...
8
votes
2answers
816 views
How can I test if a point lies between two parallel lines?
In the game I'm designing there is a blast that shoots out from an origin point towards the direction of the mouse. The width of this blast is always going to be the same.
Along the bottom of the ...
8
votes
1answer
427 views
Are there well-known algorithms for fitting a polygon to an arbitrary shape?
I'm using the Chipmunk physics engine to make the levels for a 2D C game. I'd like to be able to fit a polygon to an arbitrary shape to serve as the collision mask. Given a black and white collision ...
8
votes
4answers
787 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 ...
8
votes
2answers
1k views
pathfinding with obstacles in a Warcraft 3 like game
Consider A* searching on a tile based map. A straight forward code would be: If there is an unit inside that cell, then it is unreachable, this is ok.
But there is map resolution issue. When I look ...
8
votes
2answers
878 views
How do I determine if one polygon completely contains another?
I have 2 polygons. I know the vertex coordinates of both polygons. What's the best way to check if one is completely inside the other? For example, the algorithm should only recognize the black ...
8
votes
1answer
2k views
Am I going to regret using a color based collision detection system?
I'm just getting started build my first game with XNA (I'm experienced with C# but not games).
I'm building a pretty simple top down 2d shooter. I read this tutorial on using a color based collision ...
8
votes
3answers
887 views
How to find 2D grid cells swept by a moving circle?
I'm making a game based on a 2D grid, with some cells passable and some not. Dynamic objects can move continuously, independent of the grid, but need to collide with impassable cells.
I wrote an ...
8
votes
1answer
1k 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 ...
8
votes
2answers
2k 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 ...
8
votes
4answers
972 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 ...
8
votes
2answers
340 views
Platform jumping problems with AABB collisions
See the diagram first:
When my AABB physics engine resolves an intersection, it does so by finding the axis where the penetration is smaller, then "push out" the entity on that axis.
Considering ...
8
votes
3answers
302 views
Connecting physics simulations with different coordinate-systems
I want objects to move between two physics simulations through a "window" and collide with those from both simulations in case they intersect the window plane.
The coordinate systems of the ...
7
votes
2answers
7k 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 ...