collision-detection

2D Physics Engine: bouncing ball w/ inelastic collisions does not come to a stop

做~自己de王妃 提交于 2019-12-07 07:35:19
问题 I've created a simple 2d physics engine in Java that uses circular projectiles and straight walls. Currently, with each frame, every projectile's position is advanced by velocity * (1/fps) . Velocity is updated afterwards, once per frame. Collision detection defines a line in point-slope form using the previous and current position, checks if that line intersects with a wall, and if that intersection lies in between the previous position and current position, a collision is registered and the

Chipmunk collision detection

删除回忆录丶 提交于 2019-12-07 06:24:35
问题 I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in chipmunk that tells you that 2 given shapes have collided?. If not is the best way to simply use cgrectcontains on the sprites?. -Oscar 回答1: You can get to it from Ipthnc's link, but this is the documentation you're probably looking for - it details the collision callback system:

Algorithms for Collision Detection between Arbitrarily sized Convex Polygons

ⅰ亾dé卋堺 提交于 2019-12-07 03:35:50
问题 I am working on an asteroids clone. Everything is 2D, and written in C++. For the asteroids, I am generating random N-sided polygons. I have guaranteed that they are Convex. I then rotate them, give them a rotspeed, and have them fly through space. It all works, and is very pretty. For collision, I'm using an Algorithm I thought of myself. This is probably a bad idea, and if push comes to shove, I'll probably scrap the whole thing and find a tutorial on the internet. I've written and

Weird collision bug in Unity 2d game

丶灬走出姿态 提交于 2019-12-06 17:02:41
问题 Github Repository (Scripts folder, has all code in .cs files) I have this weird collision bug in unity, here's a gif of it: Recreating: In the gif, for example, I press both Left arrow and Up arrow until the velocity normalizes, and I get some why stuck in a block. I've had this before with my own collision algorithm when I did the game in XNA, hoped this would not happen in Unity. This is the player script PlayerMovement : using UnityEngine; using UnityEngine.UI; namespace Assets.Scripts {

About Collision detection alghorithms in AS3

▼魔方 西西 提交于 2019-12-06 16:07:24
问题 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

iPhone Pong Collision Detection

十年热恋 提交于 2019-12-06 14:50:17
问题 I have an issue where if the ball hits the paddle just right, it gets locked inside and can't be released. It happens sometimes on the player paddle, but since you have control of it, all you have to to do is move it and it escapes. The computer follows the ball perfectly, so once it gets inside it never can escape, leading to what happens in this video. Now this only happens when I increase the framerate, if it's really low, it kinda, errors out and "goes through" the paddle resulting in a

C++ bounding box triangle collision

▼魔方 西西 提交于 2019-12-06 13:17:20
问题 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

Collision Normal of two points

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 13:06:10
I'm trying to calculate the collision normal of two points. I need this for the collision response equations to calculate the new angular and linear velocities. This scenario happens when, for example, the corners of two 2d or 3d boxes collide with each other. What would be their collision normal? I now that in the case of a vertex and face collision the collision normal would be just the normal of the face. It is undefined. Technically, the collision normal should be the normal at the surface of the their configuration space obstacle (ie the set of all transformations where the two objects

Tile map Collision Detection

跟風遠走 提交于 2019-12-06 12:24:13
问题 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

Collision Detection with Rotated Rectangles

回眸只為那壹抹淺笑 提交于 2019-12-06 11:47:49
问题 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