collision-detection

how to do collision detection for hollow(?) movieclips in flash AS3?

Hey everyone, I'm making small interactive games in flash to learn AS3, now I ran into a problem that I need some help with. I need to check the collision between the player and the wall which is normally simple using the hitTestObject function. But now I made a wall object totally surrounding the player with corridors and turn, a col...

Collision detection between ball & bricks in brick breaker game

How do you detect a collision between ball & bricks in a brick breaker game? ...

algorithim for simple colision detection in Java

I'm not very experienced with Java, just started a couple weeks ago, but I have a simple applet that has two user controlled balls, drawn through java.awt and I need a way to detect a collision with between them. I have an algorithm for detecting collision with the walls: while (true){ if (xPositon > (300 - radius)){ ...

Java2D Distance Collision Detection

My current setup is only useful once collision has been made; obviously there has to be something better than this? public boolean CollisionCheck(Rectangle rect1, Rectangle rect2) { if(rect1.intersects(rect2)) { return true; } return false; } How can I do preemptive collision detection? ...

Collision detections and how efficient they are

How exactly do you implement collision detection? What are the costs involved? Do different platforms(c/c++, java, cocoa/iphone, flash, directX) have different optimizations for calculating collisions. And lastly are there libraries available to do this for me, or some that I can just interpret for my platform of choice? As I understan...

2D collision detection and stuff with OpenGL

I am working on a simple 2D openGL project. It contains a main actor you can control with the keyboard arrows. I got that to work okay. What I am wanting is something that can help explain how to make another actor object follow the main actor. Maybe a tutorial on openGL. The three main things I need to learn are the actor following, col...

Detecting when a Flash file has finished playing in Javascript

I'm using Javascript to embed a flash file into a website which I then need to remove once it's completed playing. Is there a way to do this in plain Javascript? Or will it require a callback type function to be added into the Flash file itself? How do I code this? ._. Javascript: jQuery('body').append('<embed id="flashIntro" width="...

How to handle collisions detection with multiple instances of one movieclip?

I'm using Adobe Flash CS4. The language is Action Script 3 In my library I have 2 items: player wall the player object is already functioning correctly with moving him around. Now when I place multiple wall objects into the stage (wall = 32x32 px) I want to prevent the player from moving when he walks into a wall. I've tried giving...

Collision detection problem (intersection with plane)

I'm doing a scene using openGL (a house). I want to do some collision detection, mainly with the walls in the house. I have tried the following code: // a plane is represented with a normal and a position in space Vector planeNor(0,0,1); Vector position(0,0,-10); Plane p(planeNor,position); Vector vel(0,0,-1); double lamda; // this is...

Keeping Score in XNA Game

Hi. I'm following an XNA tutorial and have the following code for collision detecting (detecting when a bullet collides with a target). Basically I'm looking to increment a score variable to display the score to the screen without re-writing the whole program. No matter where I place it in this method it seems to start incrementing from ...

Detection of Triangle Collision in 2D Space

How can I programatically detect whether or not two triangles touch each other, given their vertices on a 2D coordinate plane? This includes touching points or edges, as well as if one triangle is completely "inside" the other one. ...

Oval collision detection not working properly

So I'm trying to implement a test where a oval can connect with a circle, but it's not working. edist = (float) Math.sqrt( Math.pow((px + ((pwidth/2) )) - (bx + (bsize/2)), 2 ) + Math.pow(-((py + ((pwidth/2)) ) - (bx + (bsize/2))), 2 ) ); and here is the full code (requires Slick2D): import org.newdawn.slick.AppGameContainer...

Cone-Line Segment Intersection 2D

I would like to know if is there any way to determine if a cone is intersecting with a (finite) line segment. The cone is actually a circle located at P(x,y) with theta degree field of view and radius r: I'm trying to do it in C# but I don't have any idea how to that, so for now this is what I'm doing: Check if the line segment is i...

Does any one know is there any collision detection API for HTML5 Canvas..?

I have been experimenting HTML5 canvas by coding basic mind-mapping application. I have tried to find out if there is any javascript API used for managing object in canvas like collision detection between images or shapes. I think it is not a good idea to write my own since there might be some good API around. Anyone have clue or some in...

Per pixel collision detection in Javascript/Jquery/Gamequery

I am trying to program a web game in Jquery with the GameQuery plugin, problem is the GameQuery plugin has no support for per pixel collision detection only collision detection with bounding boxes. Is it possible to implement per pixel collision detection in javascript/Jquery? I have a world map with countries and a player which is mov...

Square collision detection problem (iPhone).

Hi, I know I've probably posted three questions related to this then deleted them, but thats only because I solved them before I got an answer. But, this one I can not solve and I don't believe it is that hard compared to the others. So, with out further ado, here is my problem: So I am using Cocos2d and one of the major problem is they...

What do the ddx and ddy values do in this AABB ray intersect algorithm?

Does anyone know what the ddx and ddy values do in the AABB ray intersect algorithm? Taken from the following site http://www.blitzbasic.com/codearcs/codearcs.php?code=1029 (show below). Local txmin#,txmax#,tymin#,tymax# // rox, rdx are the ray origin on the x axis, and ray delta on the x axis ... y-axis is roy and rdy Local ddx# =1.0...

Need help with implementing collision detection using the Separating Axis Theorem

So, after hours of Googling and reading, I've found that the basic process of detecting a collision using SAT is: for each edge of poly A project A and B onto the normal for this edge if intervals do not overlap, return false end for for each edge of poly B project A and B onto the normal for this edge if intervals do n...

collision detection of cannon balls with wall and target

I am seeking a good algorithm detecting if a moving ball is touching either a static wall or a static target. A classic Firing game logic. Anyone seen a good algorithm other than just loop them all? EDIT: i have no idea which is the best solution, BSP tree or grid based calculation, but my implementation will be on javascript and contr...

[C#] What happens when hash collision happens in Dictionary key?

I've been coding in c++ and java entirety of my life but on C#, I feel like it's a totally different animal. In case of hash collision in Dictionary container in c#, what does it do? or does it even detect the collision? In case of collisions in similar containers in SDL, some would make a key value section link data to key value s...