collision-detection

Support-function in the GJK-algorithm.

I am trying to implement the GJK-algorithm but I got stuck instantly. The problem is to implement the Support-function that isn't O(n^2). As it is now I'm computing the complete Minkowski difference, and then there is really no point in doing the GJK-algorithm. (or is it?) What I mean by Support-function is the function that returns t...

Quadtree detects collision inaccurately

Hi, I am trying to implement a quadtree of rectangles (instead of points) to be used for collision detection. For some reason, overlap/intersection/collision is not always detected. I suspect this has something to do with the way an inserted collider looks for nearby colliders (see the "COLLISION A" and "COLLISION B" sections of Quadtr...

Chipmunk conditional collision on velocity?

Hello, I am doing a game with cocos2d and using chipmunk to manage the physics. What I would like to achieve is what pretty much every nintendo game does that your character may jump and rest in a higher floor (collision shape) without causing a collision as long as the velocity is positive, and that once the velocity is negative the co...

sprite collision in game programming

When detecting collision between sprites using color alpha component, should I carry out in world space or in view (local) space, which one is more preferred? Any link or suggested book to this kind of topic is highly appreciated. Thank :) ...

Implementing z-axis in a 2D side-scroller

Hello, I'm making a side scroller similar to Castle Crashers and right now I'm using SAT for collision detection. That works great, but I want to simulate level "depth" by allowing objects to move up and down on the screen, basically along a z-axis (like this screenshot http://favoniangamers.files.wordpress.com/2009/07/castle-crashers-...

simple 2d collision problem

Hello, I want to find when a collision between a static and a moving ball occurs, but the algorithm I came up with, sometimes doesn't detect a collision and the moving ball goes through the static one. The moving ball is affected by gravity and the static one is not. Here's my collision detection code: GLfloat whenSpheresCollide(const...

Game development - handling collisions with sloped terrain

I'm trying to figure out how to handle collisions with a player trying to move over sloped terrain. For example, consider if a player is at the bottom of a half-pipe and wants to go left: At first the player is on the flat and can go directly left At some point the player starts going up a slope, and so needs to go up and left in orde...

Collisions in a real world application.

Here's my problem. I'm creating a game and I'm wondering about how to do the collisions. I have several case to analyze and to find the best solution for. I'll say it beforehand, I'm not using any third party physics library, but I'm gonna do it in house. (as this is an educational project, I don't have schedules and I want to learn) ...

K-Dop collision between different K and Volumes

And now after some work, I finally understand how the KDop bounding volume are created and how the collisions are intersected and I maked a working implementation of them. Now the problem is another. :D How can I intersect (it has to be possible, or it would not make any sense) 2 K-Dop of different K values? (obviously we know beforehan...

using boxes for hit collision

I am trying to use boxes for hit collision. I want to be precise with the collision so I was thinking about making multiple small boxes and checking for collision that way. This maybe a stupid idea or a smart one. Who knows, thats why i am asking you guys. If I do this way will that affect the performance of the game even though the boxe...

Drawing Collision on Screen

And here we are for another question. After the previous one, i finally completed the kDop system and everything related. (Hierarchycal tree of kDop, etc..) Everything works fine. Now i want to draw on screen the collision for debug purpose and to see the result of the work. (To see if the hierarchical choice i've done in a particular...

How to check if a point (int - Coordinates) is within the hypotenuse of a triangle

I've got a right triangle and I want to check if a given point is on the Hypotenuse of that triangle. All points are plain integers, not floating-point variables. Edit: All green squares would be on the hypotenuse, the white squares not. I know x, y, the Coordinates of the Corners and the Coordinates of the Point I want to test. All Co...

XNA Collision Detection - Vector2.Reflect - Help Calculating the Normal of a Circle Sprite - C#

I'm having trouble wrapping my mind around how to calculate the normal for a moving circle in a 2d space. I've gotten as far as that I'm suppose to calculate the Normal of the Velocity(Directional Speed) of the object, but that's where my college algebra mind over-heats, any I'm working with to 2d Circles that I have the centerpoint, ra...

XNA C# 2D Platformer Game

Hey, I'm trying to make (figure out how to..) a 2d platformer in XNA. I know how to create a tile grid and how to perform collision detection. I perform collision detection on the 9 bounding tiles of the player, but I'd like to know if there's a better way to perform collision detection. I've read Braid doesn't use tiles but pieced i...

Contact simplex between 2D convex polygons

How do I find the point/line of contact between two convex intersecting 2D polygons? I have implemented both the Separating-Axis test and the GJK algorithm, but neither of these return the contact simplex between the shapes (although the EPA extension to GJK will give me penetration distance). edit: This is for a physics engine, so I n...

Is there a matrix math library that is good to use alongside OpenGL to keep track of primitive co-ordinates for collision detection

Matrix math library that is good to use alongside OpenGL to keep track of primitive co-ordinates. Does such a thing exist? Is this the best way to track my objects for use in collision detection? ...

Tile based collision in XNA

I have drawn tiles in my XNA game and loaded my character. My character, however, doesn't move- the map does, which gives it the illusion of movement. Now I am wondering how to actually test against them for collision. I mean, where does the collision code go and how do I make all tiles represent 'one big thing'? ...

Overlapping labels in Qt fridge magnets example

I want to modify the fridge magnets example provided with Qt in a way that when I drag a label and drop it over another, it will push the label beneath the dragged label to the side, so they will never overlap one another. I've seen how collision is detected in the colliding mice example, where it uses a QGraphicsScene to draw the QGrap...

line-rectangle collision detection

I have one line (two point (x,y) (x1,y1)) and a rectangle with focus point (rx,ry). I need help to find out collision point between line and rectangle, an example in C++ will be help. ...

Tracking unique versions of files with hashes

I'm going to be tracking different versions of potentially millions of different files, and my intent is to hash them to determine I've already seen that particular version of the file. Currently, I'm only using MD5 (the product is still in development, so it's never dealt with millions of files yet), which is clearly not long enough to ...