collision

Perfect circle to perfect circle and Perfect circle to straight line collision HANDLING in Java

I am a newbie at Java, but decided to make a application that has a bunch of balls bouncing around. Please keep in mind that I know almost nothing about normals, which I have seen mentioned a lot in this kind of thread. I have also only take Algebra 1, and know a little bit of trig (sin, cosin and tangent). Anyways... I have collision d...

Sphere - sphere collision detection -> reaction

Hi guys, I need to make an algorithm that detects when two spheres collide, and, the direction that wich one will take an instant after the collision. Let say, Imagine like when you open your table in a pool match, all the balls are colliding one to another "randomly". So, before starting to write the code myself, I was thinking if th...

Solving a cubic to find nearest point on a curve to a point...

Ok, I have a projectile that has its position defined such that: a.x = initialX + initialDX * time; a.y = initialY + initialDY * time + 0.5 * gravtiy * time^2; I want to be able to predict which obstacles in my environment this projectile will collide with. I plan on checking the distance from A the closest point on the curve to th...

Actionscript collisions: solving exceptions and strange cases

I have created a collision class to detect collisions using pixels. In my class I've also developed some functions for determining the collsion angle. Based on this I created some examples: http://megaswf.com/serve/25437/ http://megaswf.com/serve/25436/ (Space to change gravity, right/left to give some speed to the ball.) As you will...

iPhone: Problem collision using accelerometer and chipmunk

Hi everybody ! I am facing a problem using chipmunk and iPhone accelerometer. Indeed, I defined a ball shape and body : ballBody = cpBodyNew(100.0, INFINITY); ballBody->p = cpv(160, 240); cpSpaceAddBody(space, ballBody); cpShape *ballShape = cpCircleShapeNew(ballBody, 20.0, cpvzero); ballShape->e = 0.5; ballShape->u = 0.8; ballSha...

Chipmunk body move with Parallax?

Hello. I'm using Cocos2D, SpaceManager and Chipmunk. I have a parallax node with 4 layers on it, this is tied to the location of a playable chipmunk body. This body needs to collide with static objects on one of the parallax layers, the static bodies must start off screen then move into screen and collide. I know you are not supposed...

How to move multiple rectangles as collision response?

I'm trying to make a game (using irrlicht engine with c++) where you can trap your enemy using boxes. But I just don't get how to detect what should be moved when a collision between the user and one or more boxes is detected. Another thing is that there will also be some objects called bricks which will be able to block movements. Sinc...

Move Chipmunk Body to Sprite position.

Hello. I have a Chipmunk shape, with a body, in a space. I am removing the body from the space so that I can position it and not have it fall due to gravity etc. I need to be able to make this body move, so I am not making it static. I need the body to update it's position according to the position of a Cocos2D sprite in the scene + ...

Pseudocode for Swept AABB Collision

I think swept means determining if objects will collide at some point, not just whether they are currently colliding, but if I'm wrong tell me. I have objects with bounded boxes that are aligned on an axis. The boxes of objects can be different sizes, but they are always rectangular. I've tried and tried to figure out an algorithm to ...

Tilemap - Collision layer necessary?

hey. I'm creating a 2d side scrolling game and have a question regarding the collision. I've been reading various articles and a few of them say that you should have a collision layer, which is exactly the same style as the tile layer but simply stores bits. I understand this logic, but what if my tiles are actually structs that contain...

HTACCESS Redirects

In my htaccess file, I have the following two rules. I would like to make the second one occur on the condition that the first one doesn't match. Currently, they both get run. Is there any way around the collision? redirect 301 /lorem/ipsum-keyword.html /lorem/dolorem-keyword.html RewriteRule (.*)-keyword.html$ /dir/file.php?param=$1 ...

Java Map::hashCode() collision - why?

The following code results in the same hash code being generated for the two maps, any ideas? import java.util.HashMap; import java.util.Map; public class Foo { @SuppressWarnings("unchecked") public static void main (String[] args) { Map map; map = new HashMap(); map.put("campaignId", 4770L); ...

How to write an elegant collision handling mechanism?

I'm in a bit of a pickle: say I'm making a simple, 2D, Zelda-like game. When two Objects collide, each should have a resulting action. However, when the main character collides with something, his reaction depends solely on the type of the object with which he collided. If it's a monster, he should bounce back, if it's a wall, nothing sh...

Looking for a good 64 bit hash for file paths in UTF16

Hi, I have a Unicode / UTF-16 encoded path. the path delimiters is U+005C '\'. The paths are null-terminated root relative windows file system paths, e.g. "\windows\system32\drivers\myDriver32.sys" I want to hash this path into a 64-bit unsigned integer. It does not need to be "cryptographically sound". The hashes should be case insens...

How do I write a hashcode to minimise collisions?

I know the ideal hashcode algorithm is a research area, but what sensible things can I do to minimise collisions and why do they work? For example, I've seen hashcode functions that make use of prime numbers, but I'm not clear on what the benefit is... ...

Collision Handling for moving rectangles

Hi folks, in my Silverlight 3 application, I display a tree. A self made user control is used for the treenodes, the LineArrow object for the connections. After initial displaying the tree, I want the nodes to move by the following "physical properties" there is a gravitational force, that pulls the node down there is a force vector t...

Sliding AABB collision - getting stuck on edges

I'm working on a 3D tile based game and I'm using AABB collision detection. For every cube that the player is intersecting, I find the axis along which the player is intersecting the cube the least, and push the player out of the cube along that axis. Depending on the order that the cubes are checked in, this can cause problems when sli...

How to create a level with curved lines with cocos2d + Box2d on the iphone?

Hello, I'd like to create a game that has levels such as this: http://img169.imageshack.us/img169/7294/picdq.png The Player moves "flies" through the level and mustn't collide with the walls. How can I create such levels? I found that piece of software: http://www.sapusmedia.com/levelsvg/ It's not that cheap, so I wonder whether the...

Scrolling the 2d world with physics

I'm writing a side scrolling game with physics. Before get my hands dirty i started concentrating on physics and rendering graphics. Initially i thought of keeping every thing static (non scrolling). For physics after referring to many tutorial finally i ended up here http://www.tonypa.pri.ee/vectors/tut08.html. This set of tutorial cove...

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...