collision-detection

Collision Detection between Accelerating Spheres

南笙酒味 提交于 2019-12-04 22:58:42
问题 I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that I need help with is the math of the collision detection algorithm. The iterative simulation of movement that I am using is basically as follows: (Note: 3D Vectors are ALL CAPS.) For each obj obj.ACC = Sum(all acceleration influences) obj.POS = obj.POS + (obj.VEL * dT) + (obj.ACC * dT^2)/2 (*EQ.2*

About Collision detection alghorithms in AS3

最后都变了- 提交于 2019-12-04 22:23:26
Ok. So there are several methods to implement Collision detection like R-trees, Quadtrees, BSP trees Recursive Dimensional Clustering (RDC). Or maybe more. My problem is that I have about 6-8 enemies on stage, some of them moving some of them static and also I have the Hero who is shooting with three types of missiles at same time. So I get about 70-100 objects on stage at a time. My question is, which algorithm to use for this type of problem, and which is the common practice? Also which is the most efficient? I was thinking of implementing Quad trees but I read that thy can be slow, or I am

OpenGL Vertex buffer object, can I access the vertex data for other uses such as collision detection?

。_饼干妹妹 提交于 2019-12-04 22:17:44
问题 I'm currently using the GLTools classes that come along with the Superbible 5th edition. I'm looking in the GLTriangleBatch class and it has the following code: // Create the master vertex array object glGenVertexArrays(1, &vertexArrayBufferObject); glBindVertexArray(vertexArrayBufferObject); // Create the buffer objects glGenBuffers(4, bufferObjects); #define VERTEX_DATA 0 #define NORMAL_DATA 1 #define TEXTURE_DATA 2 #define INDEX_DATA 3 // Copy data to video memory // Vertex data

Translation direction in separating axis theorem

笑着哭i 提交于 2019-12-04 20:12:14
I have implementen the separating axis theorem in java. The collision detection itself works great. But i am stuck when it comes to resolve the collision. my method to get the translation looks like this: public float getOverlap(final Projection other) { float start = m_min > other.m_min ? m_min : other.m_min; float end = m_max < other.m_max ? m_max : other.m_max; float translation = end - start; return translation; } Lets say the projection of the two rectangles in the picture looks like this. R1.min = 2 R1.max = 8 R2.min = 5 R2.max = 11 When i check R1 vs. R2 the translation will be 3 When i

Unity3d Is there something like Mesh Collider for 2D objects?

只谈情不闲聊 提交于 2019-12-04 20:00:02
Im making simple 2D game, I designed the "way" the player going through in the game. If the player touches the wall the game is over, so I must detect collisions. At first I created the walls from sprites, but then I realized there is no 2D collider that suit himself to the shape of the sprit(it was to difficult to create the collider manually from a lot of smaller polygon and circle colliders), so I made all the walls that builds the "way" 3D objects(.dae files with z=0.001), and added them the mash collider which suits himself to the 3D object. I changed my player to be 3D as well so the

Cocos2d - How to check for Intersection between objects in different layers

自古美人都是妖i 提交于 2019-12-04 19:46:51
I'm currently developing a doodle-jump style game in Cocos2d for iPhone and have a scene set up with two different layers - game objects (platforms, collectables etc...) and player (character, controlled by the player). I have these in separate layers because I want to scroll the entire game objects layer down when the player jumps up - giving it the vertical, doodle-jump style feel. The problem is that intersection between the player and the platforms doesn't occur because they're on different layers. Does anyone know how this can be solved? Some have mentioned convertToWorldCoords but I'm

Tile map Collision Detection

試著忘記壹切 提交于 2019-12-04 19:40:32
I've been looking through the other questions but just can't seem to figure this out.. I'm using XNA in a custom tilemap loader. Here is the code. http://pastebin.com/cuatQHTb using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; namespace

Add collision detection to a plattformer in pygame

廉价感情. 提交于 2019-12-04 18:27:32
I'm working on a small platformer game in which you place blocks to make a level, then play it. I got gravity, jumping, and left and right movement.. but I am not sure how to make the player collide with walls when moving left or right. The way I want it to work is like this- if key[K_LEFT]: if not block to the left: move to the left How would I go about doing this (relative to this source): import pygame,random from pygame.locals import * import itertools pygame.init() screen=pygame.display.set_mode((640,480)) class Block(object): sprite = pygame.image.load("texture\\dirt.png").convert_alpha(

C++ bounding box triangle collision

落花浮王杯 提交于 2019-12-04 16:53:33
I need an algorithm for know if a bounding box axis align (like a cube but the sides are not equal) and a triangle intersect in a 3D space. I am doing the code in C++, if the solution is extremly long, better in C++ (if you can) :), if it is a few lines don't worry if it is another language. (Determine if a vertex of the triangle is inside the box is easy, but is not easy determine if if the box and the triangle intersects but all vertex are outside of the box and the triangle.) (An algorithm of an intersection between a rectangle and a triangle in a 3d space is good too, I can divide the

Collision Detection with Rotated Rectangles

隐身守侯 提交于 2019-12-04 16:53:26
I am creating a pong game. However, in my game, the paddles have the ability to rotate about their center. These paddles are represented by rectangle2D objects. Now, these rectangles are supposed to hit the ball as it comes to them. The ball is represented by a circle2D object, and when the ball hits the paddle (this is done by using the intersects method of the rectangles), the ball reverses direction. This works fine when the paddles are not rotated, but when they are rotated, the intersects method doesn't work. When I use this statement: paddle2.intersects(xLocation, yLocation, diameter,