collision-detection

detect collision of two moving buttons in iPhone

拟墨画扇 提交于 2019-12-21 20:33:26
问题 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(,); 回答1: + (void

Triangle - Triangle Intersection Test

我的梦境 提交于 2019-12-21 20:09:40
问题 I'd like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don't need to know precise where the intersection happened, but only that an intersection has occurred) I was going to implement it following a theoric pdf, but i'm pretty stuck at the Compute plane equation of triangle 2. Reject as trivial if all points of triangle 1 are on same side. Compute plane equation of triangle 1. Reject as trivial if

android 2d arc collision detection

我只是一个虾纸丫 提交于 2019-12-21 19:27:21
问题 i have a rotated arc drawn using android 2d graphics c.drawArc(new RectF(50, 50, 250, 250), 30, 270, true, paint); the arc will rotate while the game is running , i wanna know how i can detect if any other game objects(rects ,circles) collide with it ?? this is the first time for me to write a game :) i saw something like this in http://hakim.se/experiments/html5/core/01/ Thanks in advance 回答1: Arc collisions are slightly harder then normal collisions, but using boolean algebra you can easily

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

╄→гoц情女王★ 提交于 2019-12-21 18:41:24
问题 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) {

Triangle to triangle collision detection in 3D

我的未来我决定 提交于 2019-12-21 12:29:51
问题 I understand triangle to triangle collision detection betwheen 2 triangles. Can someone explain how could I use this with a 3D object made-up of 1000s of vertexes? How can I create a list of triangles for each Mesh? Do I have to take every permutation of vertexes? That would lead up to O(n^3) which I find very bad. How can I generalise this? I will require to read data from a format. If all else fails, can someone suggest a format that makes the Mesh from triangles? I would also need a

jQuery Dragging With Collision Detection

蹲街弑〆低调 提交于 2019-12-21 12:28:27
问题 I have the following HTML: <div class="list" id="list"> <div class="item" id="i1">Item 1</div> <div class="item" id="i2">Item 2</div> <div class="item" id="i3">Item 3</div> </div> <div class="timeline" id="timeline"> </div> What I want to be able to do, with jQuery, is: Be able to drag .item s from the #list into the #timeline .item s can be dropped into the timeline as many times as required, eg. there could be 4 of item #i1 in the timeline. .item s in the timeline must not overlap each

2d balls not colliding properly

守給你的承諾、 提交于 2019-12-21 11:29:13
问题 I'm just trying to code a nice looking physics game. The ball collision looks nice but if the balls are colliding too slow, they "stick" in each other. I have no clue why they do. Here's my collision function: private void checkForCollision(ArrayList<Ball> balls) { for (int i = 0; i < balls.size(); i++) { Ball ball = balls.get(i); if (ball != this && ball.intersects(this)) { this.collide(ball, false); } } } public boolean intersects(Ball b) { double dx = Math.abs(b.posX - posX); double dy =

Collision detection with bitmaps on SurfaceView's canvas in Android

∥☆過路亽.° 提交于 2019-12-21 06:19:10
问题 In Android I use a SurfaceView to display a simple 2D game. The bitmaps (.png) with alpha (representing the game objects) are drawn on the canvas. Now I would like to do a simple but accurate collision detection. Checking whether these bitmaps are overlapping is quite easy. But how do I check for collisions when these bitmaps have transparent areas? My challenge is detecting whether two balls collide or not. They fill up the whole bitmap in width and height both but in all four edges, there

Getting the Protrusion and Collision Data From Jquery Collision

孤街醉人 提交于 2019-12-21 05:22:07
问题 I'm using Jquery Draggable Collision (found here) and I am trying to resize the draggable area (blue square, in my JSFiddle) via a simple toggleClass() right now. Once it animates(gets bigger due to toggleclass link), I would like to measure the protrusion/collision data and subtract that from the height/width of the surrounding objects. If debugging is turned on for the plugin, it will show you that it does collect protrusion/collision data, but I'm stumped on how to use it to "shrink" the

2D Polygon Collision Detection

女生的网名这么多〃 提交于 2019-12-21 04:03:07
问题 Does anyone know a simple way to check if two polygons, especially rectangles, are colliding? I found a simple way to see if two are touching by just checking if any lines on the two rectangles are colliding, but this will not work if one polygon is in another. Does anyone know a more efficient way to do this or just a way that works? Also, can someone please give me a formula for it or something like that and not just your thoughts on the subject. Thanks 回答1: Look up the Separating Axis