Questions tagged [collision]
In collision detection problems, the challenge is to determine when shapes intersect each other.
106
questions
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 ...
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 ...
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:
...
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 ...
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:
...
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, ...
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 ...
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:...
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 ...
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 ...
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 ...
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 ...
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 ...
3
votes
1
answer
289
views
Checking a circle against some bounds in a collision detector
First, some code. I have a class, Circle:
...
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 ...