Skip to main content

Questions tagged [collision]

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

13 votes
2 answers
10k views

2D Collision Detection

I wrote this a while ago but wanted to see if I went about it the right way and if my brain is working correctly. I was thinking about these two projects the other day and I recently released the ...
Tyler C's user avatar
  • 325
2 votes
2 answers
2k views

High performance, branchless Intersection testing: sphere-aabb & aabb-aabb

From my tests: AABB-Sphere: 2954.8 tests per ms. AABB-AABB: 1087.0 tests per ms. The sphere test is almost 3 times faster, but the two intersection tests seem to perform about the same number ...
jpx's user avatar
  • 29
3 votes
1 answer
1k views

Simple geometry problems involving rectangles and circles in Python 3

I'm working with some simple geometry problems featuring rectangles and circles. My code is as follows: ...
SassySamurai's user avatar
7 votes
1 answer
186 views

Kattis "Hitting the Targets" utilizing a polymorphic relashionship

In order to learn C++ I have written a solution to this Kattis "Hitting the Targets" problem Basically the program is to accept some shapes (circles and rectangles) on std in and a set of points and ...
Bomaz's user avatar
  • 297
1 vote
1 answer
255 views

Log collisions in generating unique random strings

I've created a small class to generate unique random strings. It works fine. I also want to log the collisions of the generated strings. I check if the generated string is in the array for uniquness: ...
akinuri's user avatar
  • 199
6 votes
2 answers
864 views

Computing intersections of a Polyline and a line

I wrote a script to compute / interpolate the nodes of a Polyline at a given latitude, input_lat. It works for my purpose but I am wondering if there is a better, ...
YeO's user avatar
  • 385
6 votes
2 answers
1k views

Rectangle-segment collision detection

I am working with C++ and SDL, hoping to create a game later. I am implementing the collision detection between rectangles and segments. I found this (NateS user's solution) about line-rectangle ...
Lasoloz's user avatar
  • 257
7 votes
1 answer
2k views

2D colliding disks in JavaScript (ideal billiard balls)

I am implementing a simulation of colliding disks (ideal 2D billiard balls) in JavaScript. I follow an event-driven algorithm that avoids discretizing time; the algorithm goes as follows at each step:...
Maxim's user avatar
  • 173
2 votes
1 answer
83 views

Find cells crossed by a line

This method find cells that are crossed by line A-B and adds them to one vector. I have got some duplicates here and some lines of code are very similiar but they differ in one variable. Should this ...
Mateusz's user avatar
  • 259
15 votes
3 answers
836 views

Setting the scene for a role-playing game

I made some games in Pygame, but I am still new to making games. I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the ...
Michael's user avatar
  • 159
4 votes
0 answers
151 views

Hash Based Data Structure in Java for Collision Calculation

I have started a project on my free time were I'm writing a 2D game engine in Java. One of the more challenging and interesting aspects of such a project is collision detection between sprites on the ...
mantono's user avatar
  • 161
11 votes
1 answer
359 views

Basketball Collisions with Box2d

I'm working on a new prototype that is a simple drag and shoot arcade basketball game. For this project I am working with LibGDX and the Box2d physics library. You can play the game here: Play ...
bazola's user avatar
  • 8,569
5 votes
1 answer
99 views

Clone of "Pop the Lock" iPhone Game

As an exercise, I decided to program my own version of the game Pop the Lock for the iPhone. The look and functionality are essentially the same, though the controls are modified for playing on a ...
Eric Roch's user avatar
  • 387
3 votes
1 answer
289 views

Checking a circle against some bounds in a collision detector

First, some code. I have a class, Circle: ...
Judgemental's user avatar
1 vote
3 answers
5k views

Collision detection algorithm

This is my second algorithm and I will try to make it as simple for you to understand how it works. It is pretty expensive and I'd like to make it more efficient. . It works by splitting a square ...
HDalton's user avatar
  • 13

15 30 50 per page
1 2 3
4
5
8