Detecting collision of rectangle with circle

Actually I am trying to detect thee collision of the Rectangle with the circle in the following piece of code:- function checkCollision() { //checking of the Collision if (ry + rh > cy – radius && rx + rw > cx – radius && rx + rw < cx + radius ) { dy = … Read more

How to subdivide a 2d game world for better collision detection

I’m developing a game which features a sizeable square 2d playing area. The gaming area is tileless with bounded sides (no wrapping around). I am trying to figure out how I can best divide up this world to increase the performance of collision detection. Rather than checking each entity for collision with all other entities … Read more

To use the JNI, or not to use the JNI (Android performance)

I just added some computationally expensive code to an Android game I am developing. The code in question is a collection of collision detection routines that get called very often (every iteration of the game-loop) and are doing a large amount of computation. I feel my collision detection implementation is fairly well developed, and as … Read more

Open source, pure Java physics / dynamics library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 6 years ago. Improve this question I’m looking for a lightweight, pure Java physics engine to do some simulations for robotic motion control. My requirements: … Read more

An efficient way to simulate many particle collisions?

I would like to write a small program simulating many particle collisions, starting first in 2D (I would extend it to 3D later on), to (in 3D) simulate the convergence towards the Boltzmann distribution and also to see how the distribution evolves in 2D. I have not yet started programming, so please don’t ask for … Read more

Collisions between game objects and the floor with regards to gravity?

How do games with gravity handle the relationship between moving things like players, monsters, or objects and the floor? Is the player constantly “falling into” the floor and being bounced back up? Two ways to react to collisions that I have found are moving the player back to his previous location before the collision, and … Read more

Detecting the Direction of a Collision

A square tile collides with another square tile. The bartender says… I have: The height, width, x, and y of both tiles. The 2D vector of the movement which caused the collision. I need to know from what SIDE the collision occurred (e.g. top, bottom, left, right) in order to reset the location appropriately. I … Read more

Collision Detection between two images in Java

I have two characters displayed in a game I am writing, the player and the enemy. defined as such: public void player(Graphics g) { g.drawImage(plimg, x, y, this); } public void enemy(Graphics g) { g.drawImage(enemy, 200, 200, this); } Then called with: player(g); enemy(g); I am able to move player() around with the keyboard, but … Read more

CRC32 Collision

I am trying to find a collision between two messages that will lead to the same CRC hash. Considering I am using CRC32, is there any way I can shorten the list of possible messages I have to try when doing a brute force attack? Any links to websites with hints on this will be … Read more

Fast circle collision detection

I’m trying to write a method that will calculate if two circles are overlapping. I’ve come up with the following and I’m just curious to know if there is anyway it could be optimised further. private static boolean isCollision(Point2D p1, float r1, Point2D p2, float r2) { float a,dx, dy; a = (r1+r2) * (r1+r2); … Read more