In collision detection problems, the challenge is to determine when shapes intersect each other.

learn more… | top users | synonyms

7
votes
1answer
171 views

Line segment to circle collision algorithm

I've written a function (in Python 3) which computes if a line segment (constraint) and a circle (body) collide, and returns the point of intersection (closest point to the centre of the circle): ...
1
vote
1answer
61 views

FPS efficiency for 'attack counter'

I have a code snippet which I wish to improve to increase my program's FPS, but as a beginner in JavaScript, I do not know how. I know the problem, which is the fact my counter mechanism used to delay ...
7
votes
1answer
63 views

Quad Tree and Collision Detection Implementation

I have an implementation of a quad tree and abstract collision detection classes. The code works but looks very ugly, but I don't know what I could change to make it better. The reason I used two ...
2
votes
0answers
44 views

Calculating all combinations to make sure a Random algorithm has done them all

I have done this, but it's pretty ugly and it feels like I may be missing something to shorten it: ...
6
votes
1answer
226 views

2D Platformer Collision Detection/Resolution

I am working on a 2D tile based platformer and was hoping to get someone to review my collision detection. I've only included the X collision check since the Y is essentially the same. Any ...
3
votes
1answer
66 views

Ray→plane and ray→quad intersection

This checks the intersection between a Ray and a Plane and between a Ray and a ...
3
votes
0answers
47 views

Weeding out triangles for triangle-triangle collision detection using a spatial hash

I am implementing a multi-phase collision detection system whose final collision check is checking the triangles of one shape against those of another. As the number of triangle-triangle comparisons ...
5
votes
1answer
160 views

Collision-detection for an SDL game

I am working on a simple SDL game in C++. I want to make my collision detection implementation better. Here's the complete project: ...
1
vote
2answers
193 views

Thread, handler and activity structure for a bouncing ball animation

This is a custom MyActivity class with two custom views (bar and a ball): ...
14
votes
1answer
3k views

Bouncing stacking boxes

I'm not sure if it would be better to make the envelope into an extension of the Rectangle constructor. The physics seem a bit dodgy, it works well most of the time, but sometimes the boxes overlap ...
11
votes
3answers
623 views

2D tilemap collision method

Is this the optimal method to check for collisions in a 2d-based game? I put together a working demo of 2D collisions here (WSAD to move, orange blocks collide). I currently use the following code ...
7
votes
2answers
358 views
4
votes
1answer
158 views

A Quadtree implementation with Colliders

I have created a QuadTree in Java and would like a general code review or suggestions. ...
7
votes
2answers
143 views

Performance Issues: Finding Nearest Polygon

Finding the nearest polygon out of a list of polygons seems to be quite a challenge on performance, due to lack of optimization. Consider the following image: I'll give the concept behind this. The ...
1
vote
0answers
477 views

Optimizing snap SVG animation with collision detection

I have a snap SVG animation which animates a bunch of circles, and draws a line between them if they are within a certain proximity of each other. However, I realize that there is a lot of optimizing ...
5
votes
3answers
252 views

Slow foreach loop to check for intersect

I'm trying to make a loop where it returns whether or not a rectangle collides and then to which coords the rectangle should move to. I'm calling my function like this: ...
6
votes
3answers
124 views

Orginizing/Optimising my collision detection setup

I'm creating a 2D tile based platformer with AABB (Axis aligned bounding boxes), and it works, I just want to organize and optimize my setup. Here are methods in my player class and entity class that ...
5
votes
0answers
184 views

Ways of speeding up this python implementation of SAT (Separating axis theorem)

A project I was working on required the usage of the Separating Axis Theorem to detect collisions between two convex polygons in real time. So I implemented a basic class (...
4
votes
2answers
854 views

Ping-pong game with JavaScript and Canvas

I have created my first ping-pong game with JavaScript and Canvas. I will be glad if anybody can tell me how to optimize the code and functionality. https://github.com/nikitalarionov/js-pong First ...
10
votes
2answers
334 views

Design of physics with Collision Detection using SFML

I found out that in Visual Studio 2012, it is possible to create project of SFML easily with a template. I am not an experienced C# programmer. Hence I wanted to implement a physics component just for ...
3
votes
5answers
4k views

Detecting collision of two divs

I have two divs as seen in this JSFiddle. To recreate the problem, keep clicking on the Gray container till both divisions touch each other. The purpose is to ...
6
votes
2answers
402 views

Performance of collision detection in a grid

I have fairly simple collision checking and handling Python code which is currently bottlenecking my performance quite a bit. I haven't done too much coding in python and I'm quite sure there's ...
15
votes
3answers
5k views

Overlapping rectangles

I received the following question in a technical interview today (for a devops/SRE position): Write a function which returns true if the two rectangles passed to it as arguments would overlap if ...
1
vote
1answer
93 views

Unit tests for collisions

I'm finding it a bit tedious to write unit tests for my collision class because there are so many variations of collisions that need testing. I see repetition in the set-up and assertion stages of ...
2
votes
1answer
282 views

Java Pong Game Collision between bat and ball

I have a very simple Pong game that I've built in Java. The code is quite long so I've decided to focus this question on the collision that occurs with the ball and the bat and also the effects in the ...
4
votes
0answers
155 views

Collision system in Pong-like game

I am writing a game like Pong. Therefore I am using an entity system approach, so I use a Component-based design. The hardest part until now was to write the collision system. As I just began with ...
3
votes
1answer
119 views

Collision detection accuracy

How do you guys think I can improve the code for collision detection on my website asteroidfield.eu5.org? The current code is ...
0
votes
1answer
175 views

Second attempt at canvas spatial grid collision

After posting my first question and my first attempt which you can see here: Canvas spatial grid collision I have re-written it to try and implement what the person gave as an answer. I didn't do ...
3
votes
1answer
226 views

Canvas spatial grid collision

You can see a working example here. Be sure to click on the canvas or the key inputs will not be detected! Are there any ways I could improve upon this? Anything that should have been done ...
1
vote
1answer
108 views

Breakout-like game in JS

I've made a small breakout game, so far with one level. My plan is to expand it so that it has a level editor, but for now I wanted to make sure that everything is currently looking well-designed. I ...
3
votes
2answers
167 views

BrickBreaker Spinoff in Haskell

I have an implementation of a BrickBreaker-like game where instead of pieces being just removed from the ceiling, each impact results in a new ball being released, gradually building up to a pretty ...
5
votes
1answer
369 views

Collision-checking optimizations

If I'm working in a 2D environment and have hundreds of objects, brute force collision-checking would be out of the question, but would my method below work? For example, let's say I have a ...
10
votes
2answers
325 views

Artifact collision in plane module

Here's something I tried putting together as I'm learning. Critiques on anything are welcome. There's also a logic bug in the Plane module I can't identify. The long and the short are that it takes ...
3
votes
1answer
6k views

Java Slick 2D Collision Detection Methodology

I have a collision detection for terrain setup (non-terrain is handled with a quadtree I implemented apart from this) and I was wondering how others have done it compared to mine and what I could ...
1
vote
1answer
164 views

Does this intersection algorithm work like it's supposed to? [closed]

and can I make it more efficient? It's to test the collision between a ray and a sphere. ...
2
votes
1answer
210 views

Collision detection inconsistencies [closed]

I've been wondering about simple collision in C++ for a while now, and I've tried to make up my own code. The code posted below works when walls are placed in a perfect rectangle around the player. ...
7
votes
3answers
727 views

Canvas Drawing/Animation

I am trying to learn how to write good, clean, and efficient JavaScript. I consider myself a novice, at best, in JavaScript. Any comments are appreciated. In an effort to become a better JavaScript ...
2
votes
1answer
611 views

Intersection-detection algorithm

This is an intersection-detection algorithm I developed as an alternative method to the one developed for my coursework. I won't post some of the other functions as they are used in the coursework ...