collision-detection

Collision detection between two general hexahedrons

大城市里の小女人 提交于 2019-11-29 12:54:52
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? dmckee It seems I'm too dumb to quit. Consider this. If any edge of solid 1 intersects any face of solid 2, you have a collision. That's not quite comprehensive because there are case when one is is fully contained in the other, which you can test by determining if the center of either is contained in the other. Checking edge face intersection works like this. Define the edge as vector starting from one vertex running to

C++ library for mesh to mesh intersection: what is available?

半城伤御伤魂 提交于 2019-11-29 11:17:33
I need to calculate volume intersection and penetration depth between 3D triangular meshes (e.g. in .obj format), but I am quite new to computational geometry. In a previous post ( Mesh to mesh intersections ) and from my google search, I found a few C++ libraries which might be appropriate to do the job: CGAL PQP libigl SWIFT Though, I am not sure which one could be the most appropriate for a beginner. Any suggestion? libigl as of version 1.1 has robust mesh boolean operations in igl/boolean/mesh_boolean.h . This uses either an implementation using CGAL's exact arithmetic kernel or a wrapper

JavaScript Separating Axis Theorem

放肆的年华 提交于 2019-11-29 10:59:50
问题 I'm trying to wrap my head around using the Separating Axis Theorem in JavaScript to detect two squares colliding (one rotated, one not). As hard as I try, I can't figure out what this would look like in JavaScript, nor can I find any JavaScript examples. Please help, an explanation with plain numbers or JavaScript code would be most useful. Update: After researching lots of geometry and math theories I've decided to roll out a simplified SAT implementation in a GitHub repo. You can find a

Circle-Rectangle collision side detection in libgdx

风格不统一 提交于 2019-11-29 08:48:57
问题 I have spent hours looking for the solution to this: I am developing a little top-down game with libgdx (maybe it matters what engine i am using). Now i have to implement the collision detection between my character (circle) and the wall (rectangle). I want the character to slide along the wall on collision, if sliding is possible. Let me explain: If i am moving 45 degrees right up i can collide with the down, the left or the corner of a wall. If i collide with the left i want to stop x

Collision detection of irregular shapes

坚强是说给别人听的谎言 提交于 2019-11-29 08:12:52
问题 I know how to check if a circle is about to collide with a square, and I know how to detect if a square is about to collide with a square, but how would I go about detecting if a polygon is about to collide with a square? Or better yet, when a polygon is about to collide with a polygon. OR better yet, when a shape made up of lines that are not straight collides with another similar shape, a polygon, or a circle/rectangle Is there any way to get the pixels a shape would take up maybe and the

Collision detection in html5 canvas

杀马特。学长 韩版系。学妹 提交于 2019-11-29 05:18:51
I'm trying to build a game where the user should place the circle inside a vertical bar but I'm having trouble in the collision detection function. Here is my jsfiddle : http://jsfiddle.net/seekpunk/QnBhK/1/ if (collides(Bluecircle, longStand)) { Bluecircle.y = longStand.y2; Bluecircle.x = longStand.x2; } else if (collides(Bluecircle, ShortStand)) { Bluecircle.y = ShortStand.y2; Bluecircle.x = ShortStand.x2; } function collides(a, bar) { return a.x == bar.x1 && a.y == bar.y1; } [ Edited to fix a typo and an omission ] Here's how to hit-test a rectangle and a circle for collision: Demo: http:/

Best way to detect collision between sprites?

断了今生、忘了曾经 提交于 2019-11-29 05:12:16
Whats the best way to detect collisions in a 2d game sprites? I am currently working in allegro and G++ There are a plethora of ways to detect collision detection. The methods you use will be slightly altered if depending on if your using a 2d or 3d environment. Also remember when instituting a collision detection system, to take into account any physics you may want to implement in the game (needed for most descent 3d games) in order to enhance the reality of it. The short version is to use bounding boxes. Or in other words, make each entity in the world a box, then check if each of the

Detecting div collision?

ぃ、小莉子 提交于 2019-11-29 04:47:55
This is what I am doing right now: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>untitled</title> <meta name="generator" content="TextMate http://macromates.com/"> <style type="text/css" media="screen"> body { font-family:"HelveticaNeue-Light"; margin: 0px; } input { width: 75%; } #wrap { background: #f1f1f1; border: 1px solid #d9d9d9; padding: 0px; } /* #sprite { position: relative; background: #909090; width: 20px; height: 20px; padding: 20px; }*/

3D Line Segment and Plane Intersection

旧街凉风 提交于 2019-11-29 04:05:41
问题 I'm trying to implement a line segment and plane intersection test that will return true or false depending on whether or not it intersects the plane. It also will return the contact point on the plane where the line intersects, if the line does not intersect, the function should still return the intersection point had the line segmenent had been a ray. I used the information and code from Christer Ericson's Real-time Collision Detection but I don't think im implementing it correctly. The

Avoid O(n^2) complexity for collision detection

做~自己de王妃 提交于 2019-11-29 02:59:56
问题 I am developing a simple tile-based 2D game. I have a level, populated with objects that can interact with the tiles and with each other. Checking collision with the tilemap is rather easy and it can be done for all objects with a linear complexity. But now I have to detect collision between the objects and now I have to check every object against every other object, which results in square complexity. I would like to avoid square complexity. Is there any well-known methods to reduce