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)

-5
votes
4answers
3k views

How to implement a 2d collision detection for Android

I am making a 2d space shooter using opengl ES. Can someone please show me how to implement a collision detection between the enemy ship and player ship. The code for the two classes are below: ...
1
vote
1answer
374 views

Collision within a poly

For an html5 engine I'm making, for speed I'm using a path poly. I'm having trouble trying to find ways to get collision with the walls of the poly. To make it simple I just have a vector for the ...
2
votes
1answer
664 views

Where should I place my reaction code in Per-Pixel Collision Detection?

I have this collision detection code: public bool PerPixelCollision(Player player, Game1 dog) { Matrix atob = player.Transform * Matrix.Invert(dog.Transform); Vector2 stepX = ...
1
vote
2answers
3k views

Breakout collision using 2D Rectangles?

Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; namespace BreakOut { class Field { public static ...
6
votes
2answers
2k views

Bounding boxes in octrees

I've seen that octrees are often used for things like frustum culling and collision detection in 3D. But I'm just not sure how the algorithm works at all. Surely the whole principle of the octree ...
6
votes
5answers
891 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 ...
2
votes
4answers
649 views

How to detect what portion of a rectangle a point is in?

Say I have a rectangle and a point inside the rectangle. If the rectangle was split up diagonally, how could I tell which portion the point is in? Here is a cute little mspaint diagram, where the ...
2
votes
2answers
750 views

SAT, How Do I Find The Penetration Vector?

I've just successfully implemented Separating Axis Theorem (SAT) in my game but I was wondering how do I find the penetration vector? I heard it can be useful for collision response. e.g. The harder ...
2
votes
3answers
2k views

Line segment and Sphere intersect

How can I check it if a line3D/ or ray is intersecting a sphere?
4
votes
1answer
705 views

Character jittering with this tile based collision code

I have been trying to get my collision code working for hours now but with every resource I have tried my character still jitters. First I tried using the platformer sample but my character still ...
5
votes
2answers
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 ...
2
votes
1answer
266 views

improving speed of 2d ball collision

I am making a game which has many balls bouncing around the screen (around 200-300 balls in a small area). One thing I am trying to do is improve the performance of the collision detection and ...
2
votes
2answers
793 views

Registering collision on particles

I am using CCParticleSystemQuad to create particle effects. But I want my sprites to be able to collide with particles. Say your character is a dragon, the dragon breath is a particle effect emitting ...
8
votes
4answers
12k views

OBB vs OBB Collision Detection

Say you have two Bounding Box Objects each of them storing the current vertices of the box in a vector with all the vertices of the object rotated and translated relative to a common axis. Here is an ...
1
vote
2answers
249 views

Is there a specific library to handle the collision system of a big game world like WoW, or any physics library will work?

Nothing else to add. Is there a specific library to handle the collision system of a big game world like WoW, or any physics library like ODE will work?
1
vote
1answer
550 views

Collision detection not working

I realized I put this in the wrong forum, so here it is: I made a collision detection in the Update() section, and this is the code: if (player.playerRect.Intersects(turtleRect)) { ...
6
votes
1answer
1k views

In very simple 3d racing games, how are collisions handled?

I was wondering how collisions in some simple 3d car racing games are done (especially in games like Outrun 2/Motoracer). In classic car racing games with complex environment (open world), I guess ...
2
votes
2answers
453 views

Collision Detection doesnt work because some things move more than 1px at a time

I'm writing a 2d scrolling game in javascript using canvas and since I'm limited to setInterval running at minimum once every ms, I need to have some objects moving at greater than 1 pixel a second. I ...
4
votes
3answers
5k views

Collision detection in 3D space

I've got to write, what can be summed up as, a compelte 3D game from scratch this semester. Up untill now i have only programmed 2D games in my spare time, the transition doesn't seem tough, the ...
8
votes
1answer
4k views

Microsoft XNA Platformer Example, is the Collsion Detection implemented accurately?

The example provided by Microsoft seems as if the collision detection (from what I can see) will have a small error. When the user collides with an Unpassable tile, the depth of the intersection is ...
1
vote
2answers
2k views

3d bounding Box border xna

So, I'm trying to develop a 3d table tennis game, and I'm having problems when it comes to colliding the ball with the table. I have a bounding sphere for the ball and bounding box for the table, but ...
2
votes
2answers
718 views

How do I handle walking up and down bridges at any angle?

I'm currently trying to create a 2D platformer puzzle game like Mario vs. Donkey Kong: Mini-land Mayhem! within Flash. My issues reside in the bridge collision with the walking AI. The game allows ...
0
votes
1answer
176 views

Collision Detection Result Theory?

To be clear because the title is slightly ambiguous: I understand that to check for collision detection it's (box.x > otherBox.x && box.x < otherBox.x + otherBox.w) etc. However I'm ...
0
votes
1answer
1k views

removing box2d objects before collision occurs

I am having a problem with a collision detection between the character and items, both created as box2d objects. What I am trying to do is to delete the item or remove item from the collision method ...
1
vote
2answers
714 views

Detecting a click on a tile

I'm making a simple tile-map system in LWJGL, and I'm trying to figure out how to detect if the mouse is clicking inside of a tile. So far no matter where I click it's always the same tile that is ...
2
votes
1answer
6k views

Collision intepenetration and objects getting stuck (Unity)

I am having what is probably a newbie problem with Unity, but for the life of me, I can't find a decent solution to it. In short: my rigid bodies collide, but sometimes, they interpenetrate and stay ...
1
vote
2answers
732 views

Collision Problems in Pacman Clone

I am working on a Pacman clone. I am using Java for the project. I have been having problems with collisions, and allowing the player to pass through objects. Note that the tile size (and player) is ...
1
vote
1answer
714 views

Polygon Collision Detection Android

I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was ...
1
vote
0answers
168 views

Farseer Physics EndContact events don't fire for all registered delegates

Here's my situation: I have several objects that contain a body and a fixture. They are set to sensor = true; atmosphere = BodyFactory.CreateCircle(world, atmosphereRadius / Level.METER_IN_PIXELS, ...
6
votes
4answers
2k views

Is there a way to increase the collision check efficiency of a system of n objects?

I'm making a game that consists of many onscreen objects, one of which is the player. I need to know which objects are colliding every iteration. I made something like this: for (o in objects) { ...
5
votes
1answer
279 views

In the GJK algorithm, when is a point ever closer to the origin than a line?

The GJK algorithm depends upon a function in its loop that updates the simplex and search direction for the next iteration (which is often called something like DoSimplex() or ProcessSimplex()). In ...
0
votes
2answers
450 views

Pong - Changing the Ball's Y location depending on where it hits the paddle

I'm making my first game in, Pong, and I'm trying to make the ball's Y increase or decrease, depending on where it impacts the paddle. After implementing the code below, the ball only goes down, but ...
2
votes
1answer
2k views

How do you implement 2D collision detection?

I would like to know the best or most efficient way to test for 2D collision. I am currently using AABBs, but the problem with this, is that your objects will be hitting things when they shouldn't. ...
1
vote
1answer
362 views

Why does my 2d collision and movement not work properly?

I'm trying to write(in c++ using sdl) a mario like game as in a tile based world with by pixel movement for the character and I've run into some problems I cannot seem to find the source of: 1.The ...
0
votes
1answer
381 views

Keep running CGRectIntersect Method - Objective C

I have two UIImageViews. mainSprite, and enemy1. And I have a method that makes enemy1 start moving towards mainSprite. So here's that method. -(void)enemy1Aggro{ if ...
5
votes
4answers
2k views

Which Side Was Hit?

I am working on an Android game and I have two objects A and B (both rectangles) and when they collide I simply want to know which side of B was hit. I have detected the collision fine, but I am ...
2
votes
1answer
2k views

Farseer Physics collision detection vs intersection detection with sensors

I'm trying to make a game that uses Farseer physics engine as its main collision detection engine. I have a 2d circle body object that has a matching fixture (I used the CreatCircle method. I did not ...
0
votes
2answers
440 views

Detecting collision between a sprite and many tiles

I have been looking at the following question:- Tile coordinates and am thinking of using this for collision detection in my tile game. The set up in my game is similar to this, in that there is a ...
2
votes
2answers
2k views

physics.addBody() with custom shapes in Corona SDK

Does the physics.addBody() only work with Circles and Rectangles? Or is it possible to physics.addBody() on vector shapes or sprites or with masks or something?
1
vote
2answers
3k views

Box2d and sprites

i have really little practice with box2d, but basically it seems to me that it is possible to attach to every sprite (in a 2d game) a box2d shape (that is, a bounding box enclosing the sprite itself) ...
7
votes
1answer
3k views

How do I calculate collision response between a sphere and a plane?

I'm trying to create a simple 3D game and need to constrain the player within the limits of the game world. When the player hits the sides of the world I want the player's ship to bounce off slightly. ...
1
vote
6answers
697 views

Testing whether two cubes are touching in space

Does anyone have any clean ideas on testing whether two cubes in 3D space touch? By touch I mean, touch at corners or on a face or on an edge. Say that the cubes are axis aligned and there is no ...
7
votes
2answers
3k views

How to handle pixel-perfect collision detection with rotation?

Does anyone have any ideas how to go about achieving rotational pixel-perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know ...
2
votes
2answers
999 views

General 2D Collision Detection Question

Everytime I have coded "working" collision, I always went about it very haphazardly and unstructured. If I use Axis Aligned, or Verlet, Or Euler, any or all of these theories, my problems always lie ...
4
votes
2answers
436 views

Trace with 2D terrain

I currently have some 2D terrain in my game defined by 2D coordinates with lines drawn in between them (linear interpolation too keep it simple). Now I want to cast a ray from anywhere above the ...
1
vote
1answer
461 views

XNA Silverlight 5 3D Model Position

I am use to XNA and starting to learn XNA for Silverlight 5. My Question is that in XNA when you create a Model and load it using content.load you are able to access the models Position, scale etc.. ...
4
votes
2answers
1k views

Designing Efficient 2D Collision for Topdown Shooter

This makes it the first time I'm posting here, so apologies if I stumble over beloved conventions. Currently, I'm trying to figure out how I want to handle collisions for a large number of entities ...
2
votes
1answer
241 views

Box 2d and really complex big shapes

I intended to use jbox2d for my project. But as I went deeper into it's manual I'd found out that it supports dynamic objects between 0.1 and 10 meters (if use scaling and assume that 0.1 is smallest ...
2
votes
2answers
926 views

How do I deal with abstracting collision handling code between entities with differing collision components?

I'm using a component based entity design with Components that hold the data and Systems that act on entities based on the components they have. Entities are registered to all systems as they are ...
1
vote
1answer
670 views

Can't seem to get predictive collision detection working correctly

I am trying to set up the collision detection on a basic 2d game, player clicks a button sprite moves one step int he corresponding direction. Currently all my sprites have the collision rectange ...