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

learn more… | top users | synonyms (2)

3
votes
3answers
951 views

XNA: Perform Collision Detection Against 3D Scene Geometry

How would one perform collision detection between a simple scene like the one below and a simple object like a sphere? I assume the best solution would involve convex hulls in some way but I have no ...
1
vote
4answers
2k views

Basic 2D game collision

I've been trying to program a game for the past while and I can't ever figure out one thing: collision detection. I can get up+down and left+right to work, but when I put them together, they interfere ...
18
votes
4answers
4k 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 ...
2
votes
3answers
4k views

Clean way to detect collision of object with box2d

I have been looking into box2d (in java with libgdx) lately and have been trying to create my own custom bounce effect (I increase the Restitution after the first bounce) To do this as a test I ...
0
votes
1answer
870 views

How to find which side of a collider has been hit from hit.normal?

In Unity3d, i can get the normal of the surface with which the collider collides using hit.normal, but is there a way to find which side has been hit what is provided bu Unity3d? One solution is to ...
5
votes
1answer
3k 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 ...
6
votes
1answer
928 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? ...
7
votes
3answers
736 views

Polygon editor to draw collision data over image

I need an editor to plot a polygon over the texture for of a ship in my game. It would look like this.. Where the red is the collision outline and the image is the texture. I want to store the ...
15
votes
1answer
801 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) ...
3
votes
1answer
230 views

Collision Managers and bitmaps

I am rewriting a game I made to use a (custom) collision manager that uses the minimum displacement method. As of now, my simple manager can only recognize and act on a couple of shapes - Circles and ...
1
vote
1answer
1k views

Sphere collision response

I have simple mechanism for testing of two balls colliding: private static boolean isColliding(float firstBallX, float firstBallY, double firstBallRadius, float secondBallX, float secondBallY, double ...
-1
votes
1answer
959 views

Collision detection problem

I am a novice in android. It's my first game, so I am trying to make a frogger clone. I am getting a problem in collision detection. In logcat, even though the frog is not moving and not colliding ...
12
votes
3answers
4k 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 ...
1
vote
1answer
2k views

Setting up collision using a tilemap and cocos2d

I'm building my first platformer using cocos2d and a tilemap. I'm having trouble coming up with a decent way of determining if the character is colliding with an object. More specifically, in which ...
1
vote
1answer
1k views

What is wrong with my collision detection code?

I want to check collision detection between two bitmaps but I am not getting how to do it. I read several queries and tutorials but didnt get properly. I want to check by their width and height. I ...
6
votes
2answers
452 views

Is it possible to have concurrent collision detection where every entity acts at exactly the same time?

There are many algorithms that can be used for collision detection. In many cases we check for an overlap in coordinates of an entity. If we make a triangle a,b and c. We have 2 entities at a and b ...
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 ...
1
vote
2answers
666 views

HTML5 collision with images

Can anyone please help me out with a small test game I'm creating. I'm basically creating this game to learn a few things about HTML5 and so far it's all been good. I've been able to create a canvas ...
7
votes
2answers
2k views

How do I find the point of impact with 2D per-pixel collision detection?

I'm creating a platformer and have implemented per-pixel collision detection. However, this has caused 2 obstacles that I've yet to figure out. The first obstacle, which this question is about, is ...
4
votes
2answers
2k views

Algorithm to fit shapes to 2D grid?

Let's say you have an n-by-m grid. Some squares are occupied, some are not. You want to know where in the grid you can fit arbitrary shapes such as to not hit an occupied square. The shapes would ...
4
votes
3answers
4k views

How to handle platform collisions in a 2D game?

If I have a map in my platformer game and I want my character be able to jump on some platform, for example. Is there an easy way to tell the game where the platforms are and where the player can jump ...
1
vote
1answer
2k views

How can I cancel a contact in a b2ContactListener?

To know when contacts happen we can derive from b2ContactListener and implement our own solution which is great. I'm wondering is there anyway we can cancel a contact, that is to say when we hit begin ...
11
votes
3answers
4k 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 ...
1
vote
1answer
832 views

Can you help with collision detection and response in a 3D car racing game?

I am trying to implement the collision detection and response in 3D car racing game. I have a car model, for collision I am assuming my car as a cuboid. my collision detection with walls is quite ...
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 ...
0
votes
2answers
501 views

C# XNA Framework Paddle Collision Problems

I am trying to make a pong game that uses a burger as a ball and a plate as its paddle. I have everything right except that the burger goes right through the plate. Can anyone help me? using System; ...
0
votes
2answers
917 views

How to coordinate sprites, player's position and collisions in a Bomberman-like 2D game?

I'm programming a Bomberman in Java (my first game) and I'm having problems with the player's sprites and position in the map. I'm using a 2D integer array to represent: Unbreakable blocks ...
8
votes
2answers
2k 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 ...
5
votes
2answers
1k views

Checking for Weapon Collision in a 2D overhead RPG game

I'm starting development on a 2D overhead RPG game, and am wondering what the best approach for handling weapon collision and dealing damage to enemies is. I'm currently using a basic ...
2
votes
1answer
594 views

Need help with collision detection/resolution in a 2D simulation of 'worm-like' creatures

(originally posted this on regular stack overflow, somebody pointed this forum out :-) ) Hi there, I'm implementing a physics engine for the simulation of worm-like creatures. Problem is, is that ...
2
votes
2answers
505 views

Best way to traverse triangles in a mesh

I'm implementing non-projective decals. As described in many places (ie: lengyel in the gpg2) I first need to detect all triangles that lie within some sort of frustum. Besides obvious brute-force ...
1
vote
1answer
933 views

Android Fling Gesture, Animation And Collision - Resources?

I'm starting work on a 2D Android game where the player will put their finger on a game piece and do a fling gesture to throw the piece across the gameboard. I've gone through some Android ...
11
votes
2answers
13k 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 ...
2
votes
2answers
8k views

Pygame How To Use Collision?

Can someone tell me how to implement collision in Pygame? For example I have a sprite called A and another one called B. How do I detect if they collide in Pygame?
9
votes
4answers
5k 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 ...
-1
votes
1answer
308 views

Insert object at index, when two objects collide

I have two arrays: one for projectiles, and one for targets. Every target and every projectile has tag, and a tag with color (source code I took from Ray Wanderlich). In my small game, when a ...
20
votes
6answers
3k 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 ...
2
votes
2answers
362 views

Handling collision with 2D surfaces and player sprite

What's the best way of representing surfaces in a 2d top down racing game? I'd like paved and dirt surfaces in my game to have different friction properties. Would you break up the map into a grid and ...
2
votes
4answers
4k views

How do I detect pixel-level collision using andEngine?

I'm developing a game for Android using andEngine, and I need to detect collisions only when two objects visually collide (not in blank space of the image). In J2ME, I'm able to do that using ...
10
votes
1answer
780 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 ...
5
votes
2answers
831 views

Collision response for 2D racing game

The title is fairly self-explanatory. I have a 2D racing game that utilizes per-pixel collision detection (the track is essentially two bitmaps, one for the graphics, one for collision data). The ...
47
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 ...
2
votes
2answers
938 views

Tile based map and collision; getting stuck

I'm trying to make my character move around a tile map with collisions. Everything works fine except for one thing. I show you a picture with the problem: http://i.stack.imgur.com/ZWI7x.jpg That is, ...
1
vote
1answer
425 views

How can we match polygon data structure with a background image

I am referring to this fireball game. The ball will collide with background, which is in polygon form. I was wondering, how I can match my polygon data structure with the background image. Say, I ...
0
votes
3answers
291 views

Collision Error

I am having trouble with collision detection part of the game. I am using touch events to fire the gun as you will see in the video. Note, the android icon is a temporary graphic for the bullets ...
1
vote
3answers
570 views

How does this circle collision detection math work?

I'm going through the wildbunny blog to learn about collision detection. I'm confused about how the vectors he's talking about come into play. Here's the part that confuses me: p = ||A-B|| – ...
0
votes
2answers
570 views

Bitmap & Object Collision Help

Is it possible to detect when an object and a bitmap collide. I have an arraylist of sprites that I am shooting with an image. I tried using this method here but as soon as the bitmap appears the ...
1
vote
1answer
210 views

I need help with specific types of movement

I'm adding movable crates to my game and I need some help with my movement code. The way I've set up my movement code the crate's X and Y are moved according to a vector2 unless it hits a wall. Here's ...
4
votes
3answers
778 views

Building dynamic bounding box hierachies

I've been reading about collision detection and I saw that the first part was a coarse detection which generates possible contacts using bounding box hierarchies. I understand the concept of ...
8
votes
3answers
1k 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 ...