collision-detection

Collision detection between a capped cylinder and an AABB?

I'm making a game where the player is an upright capped cylinder, and the world is axis aligned bounding boxes. Given this, how could I check if the cylinder is intersecting a box? Thanks ...

How to handle ball to ball collision with trigonometry instead of vectors?

I am making a simplified version of the ball physics app found at this SO question. I gained a lot from reading through the code and links provided at that question, but in my program I do not use vectors, I just update the coordinates of my balls (each of which has a random angle and speed) with trigonometry functions when they hit the...

How can I efficiently detect intersection detection of a ray and a mesh?

I have several 3d models in an OpenGL ES application for iPhone and at some point i want the user to touch the screen and act on them. The problem is to recognize which, among the ones rendered on the screen, has been touched. In order to achieve this I calculated the picking ray as suggested by the OpenGL FAQ, and I now want to detect i...

Calcuate x/y point that 2 moving balls will collide

Im trying to make what is (essentially) a simple pool game, and would like to be able to predict where a shot will go once it hits another ball. The first part is, I believe, to calculate if the cueball will hit anything, and if it does, where it collides. I can work out collision points for a line and a ball, but not 2 balls. So given...

Open source, pure Java physics / dynamics library

I'm looking for a lightweight, pure Java physics engine to do some simulations for robotic motion control. My requirements: Rigid body physics Joint constraints and forces Convex object collision detection Lightweight, pure Java so it can be embedded in my application Ability to run simulations quickly Handles 50-100 objects comforta...

Computing an angle from x,y coordinates

I'm trying to do collision testing between a finite line segment, and an arc segment. I have a collision test which does line segment vs. line segment, so I was going to approximate these arc segments with line segments and run my existing test. The data I have defining the arc segment(s) are three points. Two of which are endpoints th...

Line intersection with AABB Rectangle?

Preferably without using any kind of loop, as this'll be used in a game. I wish to intersect a line with a rectangle, of arbitrary size. But I also wish for the intersection point[s] to be returned. It's possible, I've done a little googling, but still have not worked it out. The line is defined using (x1,y1,x2,y2). The rectangle has ...

Looking for guidance on detecting overlap of UIImageViews

The scenario is that I have a UIViewController containing multiple "InteractiveUIImageViews" (inherited from UIImageView) each containing their own UIImage. In InteractiveUIImageView I have iplemented methods for touchesBegan, touchesMoved and touchesEnded to handle their movement and behaviour on screen. Certain objects of this type wil...

Continuous circle-point collision detection and response still allows intersections

I'm developing a game where I need to do collision detection between a mobile circle and a stationary point. I am using a continuous method. I detect if the circle will hit the point before moving it, get the time of intersection, move the circle, then give the circle a new velocity vector. In my case, the new vector pushes the circle...

Basic 2d collision detection

Where can I go to read more about basic 2d collision detection for games or just applications that have some interactivity? Edit: How about javascript for Canvas games? ...

Determining the edge normals in the SAT Separating Axis Theorem

The SAT algorithm requires you to find the normal of each edge of each shape (essentially a vector perpendicular to the edge vector) to be used as the separating axes. This can be done very simply... (x,y) => (-y,x) OR (x,y) => (y,-x) Which should be used in the SAT algorithm? This is essentially a question of whether the left hand n...

How to detect collisions between sprite and a user generated shape of some sort?

How to detect a collision between a sprite and a user generated shape of some sort. For example. There are some objects on the screen. The user takes their finger and draws an circle shape around a object (The selection rule is painting circle around the sprite, but the painting shapes may be various). I need to detect which object sele...

iOS - Drag and drop collision detection How to detect when your selected item drags over another subview?

We are adding drag and drop functionality to what is to become a sports field with positions for players. The positions are mapped out using Interface Builder with each being a separate UIImageView. We want to be able to drag player images from bench positions from the side of the screen onto positions on the field. How best can we d...

2D Polygon Collision Detection

Does anyone know a simple way to check if two polygons, especially rectangles, are colliding? I found a simple way to see if two are touching by just checking if any lines on the two rectangles are colliding, but this will not work if one polygon is in another. Does anyone know a more efficient way to do this or just a way that works? ...

How to make a moving object "stick" to a stationary object in box2D

Hello, I have been experimenting with the box2D sample project within cocos2D for the iPhone and am wondering if box2D is the appropriate engine to use to make a moving object "stick" to a stationary object when the moving object is finished moving in a certain direction. Here is a simplification of what I am trying to achieve: I hav...

Why does this only detect touches in the center of the CCSprites?

I am trying to let the finger drag CCSprite with the following code: -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint location = [touch locationInView: [touch view]]; CGPoint convertedCoordinate = [[CCDirector sharedDirector] convertToGL:location]; CGRect redCircleRect = CGRectMake(redCircle.positio...

2D Collision Detection between squares, simple but more specific than boolean + immune to large spacial jumps

Would like to know which direction player hits terrain tile from (just a simple up/down, left/right). Everything I find is either too simple, or is much more complex and seemingly way too much for what I need, like with AABB (granted it's hard to tell, my brain has trouble digesting what amounts to really long equations). What I've got s...

Collision detection delegate scheme

Hey guys! My physics engine is coming along quite nicely (thanks for asking!) and I'm ready to start working on some even more advanced junk. Case in point, I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs. Let me set up a scenario for you: Say we have object A, object B, ...

OpenGL GL_SELECT or manual collision detection?

Greetings all, As seen in the image I draw set of contours (polygons) as GL_LINE_STRIP. Now I want to select curve(polygon) under the mouse to delete,move..etc in 3D . I am wondering which method to use: 1.use OpenGL picking and selection. ( glRenderMode(GL_SELECT) ) 2.use manual collision detection , by using a pick-ray and che...

Algorithm to find solution to puzzle.

Hello! I am trying to make a game where a player have to find his way from Start to End on the Game Board. As you see this Game Board contains a bunch of red circular obstacles. To win the game the player has to remove a minimum amount of obstacles. So my question is, how do I programatically find out the minimum amount of obstacles t...