collision-detection

C# simple 3D Collision detection

∥☆過路亽.° 提交于 2019-12-04 16:45:57
I'm trying to develop a simple 3d environment (in openTK, so basically openGL) and implement simple collision detection. I will have the camera object which will have a bounding cube and a world full of triangles and quads. If I'm given a bounding cube (or bounding sphere if that's easier) and a list of polygons, is there a quick and dirty way to do basic collision detection? Thanks for any help Ok, for simple bounding box collision, I wrote the following method that will accept a BoundingBox object and determine if it is inside the the current instance of a BoundingBox . A bounding box

Collision detection in Java game?

故事扮演 提交于 2019-12-04 14:07:00
问题 I am developing a game in which I have the problem of collision detection of moving images. The game has a spaceship and number of asteroids (obstacles). I want to detect the collision between them. How can I do this? 回答1: Collision detection is generally tricky for anything other than rectangles. The way I've done this in the past is to provide both an image and a mask for each object. So for example, an object like the Jupiter 2 spaceship from Lost in Space would have the following image

detect collision of two moving buttons in iPhone

末鹿安然 提交于 2019-12-04 13:50:39
I am using the below function to move two buttons on the screen + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished)); Now I want to detect the collision of those moving button. So I want to know is there any event which is getting fired when the object is animating(moving). Or where else can I place my condition of CGRectIntersectsRect(,); amattn + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:

XNA Collision Detection - Vector2.Reflect - Help Calculating the Normal of a Circle Sprite - C#

情到浓时终转凉″ 提交于 2019-12-04 13:42:46
I'm having trouble wrapping my mind around how to calculate the normal for a moving circle in a 2d space. I've gotten as far as that I'm suppose to calculate the Normal of the Velocity(Directional Speed) of the object, but that's where my college algebra mind over-heats, any I'm working with to 2d Circles that I have the centerpoint, radius, velocity, and position. Ultimately I'm wanting to use the Vector2.Reflect Method to get a bit more realistic physics out of this exercise. thanks ahead of time. EDIT: Added some code trying out suggestion(with no avail), probably misunderstanding the

How do I test for collision of two moving 2d oriented bounding boxes?

坚强是说给别人听的谎言 提交于 2019-12-04 13:14:17
问题 The OBBs have a position(x,y), a velocity(x,y) and an orientation(Matrix). Given periodic updates, the OBBs must collide with each other, returning the fraction of the move that was deemed successful. I have looked at the Polygon test on the GPWiki - http://gpwiki.org/index.php/Polygon_Collision - but it does not account for moving objects or an object that is completely within an OBB. The book Real Time Collision Detection covers 3D OBBs in Chapter 4: Bounding Volumes, but the method for

Algorithms for collision detection between concave polygons

邮差的信 提交于 2019-12-04 12:30:05
问题 Is there any good algorithm for detection between concave polygons? I'd appreciate any help as so far I've only found algorithms for detection between convex polygons. 回答1: You may find this paper interesting. 回答2: This is old, but still relevant and there doesn't seem to be alot of answers for this question, so here goes: For polygons whose overall shape does not change (may rotate and scale, but relationships between vertices may not change), there are ways to pre-process the vertex data to

Libgdx Collision Detection with TiledMap

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:14:07
问题 I'm struggling with implementing a collision detection system through the tiledmap. I have a 2d "pokemon style" game that has a tiled map rendered. Specifically, I have a 'collision' layer in my tiled map .tmx file that I want to interact with the player and other entities. My question is how do I connect the player sprite (extends Sprite class) to the 'collision' layer of the tiledmap and cause collision between the two. Any advice is appreciated. 回答1: First of all your Player should

XNA - Pong Clone - Reflecting ball when it hits a wall?

冷暖自知 提交于 2019-12-04 11:27:15
I'm trying to make the ball bounce off of the top and bottom 'Walls' of my UI when creating a 2D Pong Clone. This is my Game.cs public void CheckBallPosition() { if (ball.Position.Y == 0 || ball.Position.Y >= graphics.PreferredBackBufferHeight) ball.Move(true); else ball.Move(false); if (ball.Position.X < 0 || ball.Position.X >= graphics.PreferredBackBufferWidth) ball.Reset(); } At the moment I'm using this in my Ball.cs public void Move(bool IsCollidingWithWall) { if (IsCollidingWithWall) { Vector2 normal = new Vector2(0, 1); Direction = Vector2.Reflect(Direction,normal); this.Position +=

Efficient algorithm for collisions in 2D game?

我们两清 提交于 2019-12-04 09:50:21
I'm programming a Bomberman in Java following a tutorial (this is my first game). The tutorial suggests the following code for detecting collisions. for (int p=0; p<entities.size(); p++) { for (int s=p+1; s<entities.size(); s++) { Entity me = (Entity) entities.get(p); Entity him = (Entity) entities.get(s); if (me.collidesWith(him)) { me.collidedWith(him); him.collidedWith(me); } } By now, entities is an array list containing the enemies and the player. As I want to also detect the player collides with walls, should I put every single wall or bricks tile in the level into the entities arraylist

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

百般思念 提交于 2019-12-04 08:31:15
问题 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 reasonably fast as I can make it in Java. I've been using Traceview to profile the code, and this new piece of collision detection code has somewhat