collision-detection

Javascript: Collision detection

Hello, could someone please help me to understand how collision detection works in JS? I can't use jQuery or gameQuery - already using prototype - so, I'm looking for something very simple. Not asking for complete solution, just point me to the right direction. Let's say there's: <div id="ball"></div> and <div id="someobject0"></div...

Collision detection in Java game?

I am developing a game in which I have the problem of collision detection of moving images. The game has a spaceship and number of asteroids (obstacles). I want to detect the collision between them. How can I do this? ...

Sliding Response after a Point-Square Collision

In general terms and pseudo-code, what would be the best way to have a collision response of sliding along a wall if the wall is actually just a part of an entire square that a point is colliding into? The collision test method used is a test to see if the point lies in the square. Should I divide the square into four lines and just cal...

Collision Detection - Java - Rectangle

I would like to know if this is a good idea that conforms to best practices that does not lead to obscenely confusing code or major performance hit(s): Make my own Collision detection class that extends Rectangle class. Then when instantiating that object doing something such as Collision col = new Rectangle(); <- Should I do that or i...

2D colliding n-body simulation (fast Collision Detection for large number of balls)

Hello I want to write a program for simulating a motion of high number (N = 1000 - 10^5 and more) of bodies (circles) on 2D plane. All bodies have equal size and the only force between them is elastic collision. I want to get something like but in larger scale, with more balls and more dense filling of the plane (not a gas model as he...

Way to get amount of colliding elements?

Is there a (simple) way to return the amount of elements colliding with a single element? Perhaps with jQuery? ...

Using glRotate and glTranslate with collision detection.

Hey guys, Say I use glRotate to translate the current view based on some arbitrary user input (i.e, if key left is pressed then rtri+=2.5f) glRotatef(rtri,0.0f,1.0f,0.0f); Then I draw the triangle in the rotated position: glBegin(GL_TRIANGLES); // Drawing Using Triangles glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1....

Opinions on collision detection objects with a moving scene

So my question is simple, and I guess it boils down to how anal you want to be about collision detection. To keep things simple, lets assume we're talking about 2D sprites defined by a bounding box. In addition, let's assume that my sprite object has a function to detect collisions like this: S.collidesWith(other); Finally the scene is m...

Advance way of using UIView convertRect method to detect CGRectIntersectsRect multiple times

I recently asked a question regarding collision detection within subviews, with a perfect answer. I've come to the last point in implementing the collision on my application but I've come across a new issue. Using convertRect was fine getting the CGRect from the subView. I needed it to be a little more complex as it wasn't exactly rec...

Collision detection of huge number of circles

What is the best way to check collision of huge number of circles? It's very easy to detect collision between two circles, but if we check every combination then it is O(n2) which definitely not an optimal solution. We can assume that circle object has following properties: Coordinates Radius Velocity Direction Velocity is c...

WPF: How to get the event when one FrameworkElement comes in contact with other FrameworkElement

I am developing a small application with images and trash box icon on right hand bottom. I have multiple images floating in the main window, and using mouse I can move image from one corner to other corner of window, left, right, top and bottom. I can't figure out how do I catch an event when a image touches and panel (with trash box ...

Collision detection, alternatives to "push out"

I'm moving a character (ellipsoid) around in my physics engine. The movement must be constrained by the static geometry, but should slide on the edges, so it won't be stuck. My current approach is to move it a little and then push it back out of the geometry. It seems to work, but I think it's mostly because of luck. I fear there must b...

Using CGRectIntersectsRect for collision detection

Hi guys, I've got a long rectangular image which is rotated at different kind of angles. However the frame of the rectangular image does not rotate along with the image and instead, the rotation causes the frame to to become larger to fit the rotated image. So when I used CGRectIntersectsRect, the collision detection is totally off beca...

Collision Detection for arbitrarily sized, positioned and rotated rectangles in XNA

I'm working with xna in C# and in my game I will have a variety of space ships flying all over the place. They will each have an arbitrary rotation, size and position in space and I need a method to determine when they collide. Ideally the method would take two Rectangles, two doubles and two Vector2s for size, rotation and position resp...

How to identify four sided polygon (not rectangle) collision detection?

I am developing 2D game for iPhone, for that I need to handle collision detection. My need is: I have two polygons, each is a four-sided polygon (not a rectangle), I need to check whether they are collided or not. ...

2D Platformer Collision Problems With Both Axes

I'm working on a little 2D platformer/fighting game with C++ and SDL, and I'm having quite a bit of trouble with the collision detection. The levels are made up of an array of tiles, and I use a for loop to go through each one (I know it may not be the best way to do it, and I may need help with that too). For each side of the character...

Sprite to Line Collision

If I have a sprite, how would I check collision between two points? For example, in a game I am making, I would like to draw multiple lines that my sprite collides against. I'm thinking that this is more flexible than other collision systems if I had a lot of platforms. ...

Detecting wether a point is inside or outside of a raphael.js shape

I have a raphael.js shape which I am plotting circle's on top of. I only want a circle to appear if the circle does not go off the boundary of the shape it is being plotted on to. To make this more clear, here is an example of what I do not want to happen: I want the circles outside of the grey area not to appear. How would I detect ...

What is the best approach to 2D collision detection on the iPhone?

Been working on this problem of collision detection and there appears to be 3 main approaches I could take: Sprite and mask approach. (AND the overlap of the sprites and check for a non-zero number in the resulting sprite pixel data). Bounding circles, rectangles or polygons. (Create one or more shapes that enclose the sprites and do...

how to access a different movieclip within the flash in AS3

I've been trying to learn Action Script 3 the past few weeks, making tiny interactive games to learn the basics. I stumble upon a problem every now and then but most of the times google helps me out. But this problem has got me stuck so please help: The main stage contains two objects(movieclips), the player and a wall. The player has ...