collision-detection

Advice on collision detection APIs

I have been trying out bullet SDK for collision detection in games in my spare time but I have found it hard to learn since there are scarce examples to learn from on the Internet. Question: What alternatives do I have for collision detection in terms of: Ease of use Support Availability of tutorials online And, preferably, an open-s...

Algorithm to find whether 2 objects on a 2D Plane will collide

I'm trying to determine whether Object1 will collide with Object2 given the following information: 1) Objects' bounding boxes (uses bounded-box collision detection) 2) Objects' speeds 3) Object's current locations (x, y coordinate) 4) Objects' directions (Up, Down, Left, or Right) For a bit of imagery, imagine the objects traveling ...

Android - Setting bitmap collision detection after rotation by matrix

How do I create code for collision detection on a bitmap rotated by a matrix? canvas.drawBitmap(mAnimation, mainMatrix, null); mainMatrix is derived from a PathMeasure so i do not know the rotation The bitmap is rotated around x=0,y=0 and thus a circle around the centre will not work (or at least be too big) thanks ...

Java HashMap detect collision

Is there a way to detect collision in Java Hash-map ? Can any one point out some situation's where lot of collision's can take place. Of-course if you override the hashcode for an object and simply return a constant value collision is sure to occur.I'm not talking about that.I want to know in what all situations other that the previously...

Numpy position and vector arrays - implement collision detection

I'm using point sprites in PyOpenGL with numpy and glDrawArrays. So I have two arrays, one for the points and one for the vectors. r = lambda: random.random() self.pts = numpy.zeros((2000,2), dtype=numpy.uint16) for pt in self.pts: pt[0] = 300*r() pt[1] = 200*r() self.vect...

2D Collision Detection Code

Does anyone know a very simple physics engine, or just a set of basic functions that could complete these tasks: Simple point, line, and rectangle collision detection? I looked at Box2D but it is way too advanced for what I am making. I just need some simple code. Thanks in advance! ...

Collisions and velocity, how do I predict hits that will take place between this update and the next?

I'm doing simple collisions on moving, coloured pixels. If their velocity get's higher than 1, the pixels may pass through something in the static world I'm trying to collide with. How do I compensate for this? ...

Enter Frame does not detect hitTestObject precisely when tweenling

I have a function with Enter_Frame running and have it tween during the function. I know you could use object.y=object.y + 1 instead of the TweenLite i'm using now. But TweenLite gives the best effect I wanted. My problem now is, I wanted to remove the enter_frame function when its not collision each other. But when I traced hitTestObjec...

Scaling Arbitrary oriented and dimensioned 3D boxes for force no intersection

Hi all, I have a set of 3D boxes with arbitrary dimensions, translations and rotations. I need to force the boxes not to intersect by scaling them by a single constant over their 3 dimension components. At the moment I am doing this iteratively by checking for intersection and then reducing the scaling iteratively until there is no i...

Cannot implicitly convert 'bool' to 'int' - collision detection

Hi I am trying to make a simple collision detection class for a soccer game. Here is the code: int Collision(int x1, int y1, int radius1, int x2, int y2, int radius2) { int dx = x2 - x1; int dy = y2 - y1; int radii = radius1 + radius2; if ((dx*dy)+(dy*dy)< radii * radii) { return true; } ...

Collision Detection Implementation

Hi I have a collision detection class that works by finding the distance between the centres and whether that distance is small enough to be a collision (see Collision Detection error). My problem is trying to make this actually work, with ellipses colliding. I will explain more if necessary. Thx ...

Check for collision of ball in a circular path and a stationary object on the path for iPhone app

I have set a ball on a circular path by animating its layer. When i checked for collision with another object, I tried use CGRectIntersectsRect but to no avail. What is the difference between a layer and the frame? I suspect that the frame is not following the layer animation hence CGRectIntersectsRect is not something that I should be ...

Pixel Collision iPhone/iPad

Hi This is the first time I have ever attempted to do something like this, and just using rectangle collision with CGRectIntersectsRect for my UIImageViews isn't good enough anymore. What is the absolute simplest/best way of achieving pixel collision? All I need is for the alpha pixels to not collide, right? Hope you can help, thank...

How can I detect if a ball is moving away from a wall?

The balls are defined as a circles with a radius, a position and a velocity, which is a 2D vector. The walls are defined by a start point and end point. I am able to detect the collision between the ball and the wall and know how to reflect it about the normal. However the same collision can be detected AGAIN and the change of direction...

Javascript HTML5 Canvas Collision Detection

I'm working on creating an Air Hockey-like game using HTML5 canvas and Javascript. I've gotten pretty far, but detecting the collision of the mallet and the ball has me stumped. I've tried using the distance between the two circles and distance squared (to conserve CPU by bypassing square root). I can't figure out why the collision is no...

Constraining a back wheel to the front wheel

Hopefully I can describe my situation clearly as whenever I try to describe it to others on the whiteboard or pen and paper it takes a few attempts :) Part of my program involves a cart that rides along a rail and the cart runs on two wheels. The rails is a simple line which hills up and down in curves and also flattens out. To create t...

silverlight drag and drop collision detection

Hello everyone, I am trying to develop a simple prototype app with the following requirements: click and drag multiple elements highlight valid containers for dragged element(s) on mouse move a "snap-to" feature when the dragged element(s) are placed inside the valid container element remains in container if mouse is released with obj...

HTML5 Canvas: Mouse and polygon collision detection

So I'm making a tower defense game with HTML5 and Javascript. My sole problem is detecting when the mouse comes in contact with the attacker's pathway, which is necessary in order to stop the player from building towers on the path. The path of the attackers is determined in the MAP.js file (see the link at the bottom), by a two dimensio...

point - plane collision without the glutLookAt* functions

Hi, As I have understood, it is recommended to use glTranslate / glRotate in favour of glutLootAt. I am not going to seek the reasons beyond the obvious HW vs SW computation mode, but just go with the wave. However, this is giving me some headaches as I do not exactly know how to efficiently stop the camera from breaking through walls. ...

Collision detection between two general hexahedrons

I have 2 six faced solids. The only guarantee is that they each have 8 vertex3f's (verticies with x,y and z components). Given this, how can I find out if these are colliding? ...