# Tagged Questions

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

5k views

### Ball collisions 'sticking' together

I have a program which simulates many bouncing balls. The balls can bounce off each other and off the sides of the container. The problem I am having is that sometimes when two balls collide, they ...
127 views

### How can I handle fighting game collisions for complex animations?

Imagine that I have an animation like this. As you can see, this attack hits in three horizontal places. The opponent facing this player could be hit mid and low (standing or crouching). The same ...
36 views

### Polygon movement towards certain point libGDX

I recently started using the Polygons but I'm have struggle as I'm trying to make a Polygon move towards the center of my screen, although I don't know how. Here's the code I have(What I'm trying to ...
22 views

### Custom Tile Collision Detection Has Trouble With Edges

So, I'm writing my own game to expand on my abilities as a programmer. However, I have come to a writer's-block of sorts. The game I am building uses tile collision, but allows the player to be in an ...
659 views

### How to flick gameObject using Touch?

I've been searching for a solution for my problem for a while on the web, but i didn't find anything that work properly What i want to do I have a bouncing ball and I want to let the user flick it ...
317 views

### How to impale and stack targets correctly according to the collider and its coordinate?

I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how: At the start, the falling object (in red) will fall in a ...
145 views

### Two dimensional elastic collision of balls

I am trying to create a simple elastic collision simulation in java. (I am using some helper libs like StdRandom) Here is my Ball class : class Ball { double cx, cy; Vector velocity; ...
40 views

### UE4: Multiplayer Projectile Hit Detection Problem

I'm trying to do Projectile Hit detection in multiplayer game. I'm using next approach: On the server side I'm storing all character's positions with world timestamp(PositionUpdated method). When ...
103 views

### How to calculate distance of travel needed get achieve speed x?

I have a boat traveling at 20 meters/second approaching destination x. Destination x has a range radius of 10 meters. What I would like to do is make sure by the time the boat arrives within 10 meters ...
156 views

### How to retrieve vertex information from ID3DXMesh

I need to know the position of each vertex (and triangles) from a mesh (a pointer to ID3DXMesh, created by calling functions like D3DXCreateBox, D3DXCreateTeapot and D3DXCreateSphere) to perform some ...
652 views

### 3D collision physics. Response when hitting wall, floor or roof

I am having problem with the most basic physic response when the player collide with static wall, floor or roof. I have a simple 3D maze, true means solid while false means air: bool bMap[100][100][...
63 views

### Tiled height level collision

I have created the below tilemap in tiled and I am wondering about a good approach to "separate" these two different heights in the map. I would like to keep it tile based, so adding a object layer ...
41 views

### Collision Detection between two instances of the same Prefab

I am a trying to recreate the first stage of Super Mario Brothers, but I am having a bit of trouble with the collision system between Koopa Shells. I have written two different scripts in hopes to ...
179 views

### Picking a 2D Box Collider with the mouse in Unity

I have a scene with a bunch of 2D doors that have 2d Box Colliders (no trigger) on them and that live on a Canvas. I would like to be able to click on them with the mouse, but have had no luck. ...
406 views

### Using Bullet physics engine to find the moment of object contact before penetration

I would like to use Bullet Physics engine to simulate the objects in 3D world. One of the objects in the world will move using the position from 3D mouse control. I will call it "Mouse Object" and ...
189 views

### Ray & Segment Intersection

I'm writing some code to check intersection between all of a rectangles segments and a ray. It will sometimes use the Left and Right side of the rectangle as the closest face hit (face DA & BC) ...
230 views

### How do I induce collision events in LibGDX 3D?

In the code below I've put an example of something I want to do. I have the camera and I want it to stop moving whenever it hits one of the boxes, how do I do this? public class Main extends ...
2k views

### How can I optimize a collision engine where order is significant and collision is conditional based on object group?

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 ...
21 views

### Making different collision mask for separate frames in GameMaker

I've been using Game Maker for a while as a beginner but as I tried to do harder things I was faced with a huge problem, I was trying to make a part of my game where the character goes through moving ...
30 views

### IgnoreCollision while Dodging & Colliding

I'm working on a mechanic to allow the player to dodge through enemies. However I'm running into the issue where the player is only able to dodge through enemies while their already dodging when they ...
1k views

### Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
124 views

### Libgdx: Check collisions in Stage among actors

My goal is to check collisions among the actors that are in the Stage. My question is: is it necessary to maintain a list for each type of actor I have? Doing that I get 3 problems, 2 bad design ...
493 views

### LibGDX: Colllisions between bullets and enemies in arrays

I am writing a "Gauntlet" style game. So far I have managed to successfully detect collisions between my player object and my ghost enemy objects, and when they collide they drain the player's energy. ...
69 views

### given the position and velocity of an object how can I detect possible Collision?

I'm trying to detect Collision between autonomous moving objects and steer direction if collision is detected. so far I've been following a tutorial and I'm having a hard time to fully understand how ...
104 views

### Bounce with multiple collisions

Here's the problem: I'm writing arkanoid-like game in Unity 5.3. I'm using 3d physics and simply ignoring z-axis in computations. No gravity, 0 drag and velocity reset every bounce by script. My ball ...
28 views

### Changing speed of an object

Is there a way of changing speed of an object at certain time? I want to change my speed to my initial speed after colliding with any object. I have already added bounce Physics to my colliding ...
65 views

### BoxCollider2D Not Working

So I'm making a copy of noobtuts tutorial on Snake - http://noobtuts.com/unity/2d-snake-game I've done all their steps and am at the point of extending the game solo, however I've an issue with the ...
856 views

### How do you set multiple collision rules with Swift and SpriteKit?

So basically I've got 2 types of balls and 2 types of enemies. Green can delete red only, red can hit delete only. Here's what I have for the first collision test: func didBeginContact(contact: ...
5k 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. ...
143 views

### Could triangles be used for swept-AABB checks between positions?

I'm trying to understand swept-AABB collision detection. When checking for collisions between two positions of an object, I commonly see one of 3 strategies used: Rays: trace rays from parts of the ...
175 views

### Rigidbody stuck on the edge of two colliders

could You please help me with that weird bug? I've seen other people's posts about that bug, but I couldn't really understand how to fix it. As You can see, the boxes are standing right next to each ...
28 views

### Can't make sprite collide with tilemap made with Tiled

I'm a newbie who just started learning phaser. I have created a tile map with Tiled. It is composed of two tiled layer: background & collision. In collision layer I put some walls. And in the ...
36k 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 ...
63 views

### How to implement A* pathfinding for enemies to follow player

The enemies in my game are supposed to follow the player in order to cause damage to it. Right now I have it where the enemy just goes in the direction that will bring it closer to the player, and ...
35 views

### Mesh Collider in Monogame

I try to implement a few complex objects and want to achieve that they collide based on everything the player is able to see. Therefore I am not able to use the basic BoundingSpheres. Has anybody an ...
31 views

### XNA/MonoGame Collisions between two boxes don't work as expected

I have the following problem: I have two GameObjects (one is static, the other is the player). Both of them have one BoundingBox that surrounds them, and a List that contains more BoundingBoxes for a ...
288 views

### How to detect collision position and that position's texture color in Unity?

I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?
321 views

### Swift - How do I detect the exact point at which two “SKPhysicsBody(edgeFromPoint:” type physics bodies intersect in sprite kit

I have two physics bodies attached to two separate sprite nodes using Sprit Kit. One is a vertical line and one is a horizontal line: //sprite with horizontal physics body spriteMatrix[i][j]....
287 views

### Collision detection doesn't register until player sprite jumps

I have implemented a shooting mechanic into my game, and the act of shooting works fine. The shooting work is done in my "game1" class. The issue that arises is when I incorporate collision detection ...
85 views

### How to use collision masks and overlap_area in pygame?

So, I've been prototyping a game, and I've been using sprite collision, and it's not cutting it any more. I read up on the documentation about masks and overlap area: https://www.pygame.org/docs/ref/...
663 views

### Basic 2d platform collision detection algorithm has a slight bug (Java)

I'm trying to implement collision detection between Player (the main character) and a Platform. They are both modelled as rectangles; when player hits the side of a platform he should bounce off it ...
209 views

### 2D Collision at corners using C# - without xna or unity

I'm trying to make collision for a 2D game, the player (car) has to collide with the walls of the track when it hits them. I looked into pixel color detection, and X,Y -based collision (But since its ...
32 views

### Rotated Sprites collision detection

I am trying to implement checkCollision function in my game, I used AABB method but the problem is that my sprites are rotated so it's not really precise. I could finely describe my Sprites with ...
89 views

### Issue with detecting collisions in Pong

I've been working on making Pong in OpenGL and SDL and currently have both paddles and the game ball set up properly. I have an Object (or Entity) class which is used to instantiate each of the ...
6 views

### Detecting collision between browser window middle point and other sprites visible in the window

In HTML5 canvas, I have an object which is always in the middle point. On the big map there are other moving objects. I want to detect if the middle point of the window hit any shape we see on the ...
25 views

### Retreive 3d World Map coordinates from touch/click input with LIBGDX?

Problem: I am trying to create an RTS style interaction. I want to be able to click on the map and have characters move to the click location. I haven't been able to figure this out, even after ...
183 views

### How to do one-way collision?

I would like to know how can I do one way collision. It's the collision common in mario's games and many platforms. I try to do an code but I cannot post because it's part of a paid game. Basically I ...
129 views

### My “puck” model object falls right through the “table” model in jMonkeyEngine

So I am trying to learn jMonkey, I have understood everything so far, and I thought I understood how to make objects solid, so things can't go through each other. When I create my Collision shapes, I ...
75 views

### Collision Between SKSpriteNode and SKShapeNode

Im trying to create a collision between to objects. one is a SKSpriteNode and the other is a SKShapenode. the Code I have so far for Contact is : func didBeginContact( contact: SKPhysicsContact) { ...
153 views

### Where should I save game object's attributes (hp, score) in Swift?

Scenario: I have a game with several game objects on screen. Each can have different score and hitpoints. When I use collision detection for cannonball vs. ship (example) I need to know which ship is ...