collision-detection

Text Collision Detection

半世苍凉 提交于 2019-11-26 22:10:30
问题 I am building a web application that draws a set of letters in different fonts on an HTML 5 Canvas using fillText . The user will click somewhere on that canvas and I need to check which letter they clicked on (or if they clicked on a letter at all). I think I will need to: Get the vector path for each letter (I have no clue how to do this). Check if the click point is inside the letter path using some simple collision-detection algorithm. Is there some easy function to do this that I am

Line intersection with AABB Rectangle?

左心房为你撑大大i 提交于 2019-11-26 22:01:16
Preferably without using any kind of loop, as this'll be used in a game. I wish to intersect a line with a rectangle, of arbitrary size. But I also wish for the intersection point[s] to be returned. It's possible, I've done a little googling, but still have not worked it out. The line is defined using (x1,y1,x2,y2). The rectangle has these two points too. I would recommend simply doing a line-segment-line-segment intersection check on each line segment (edge) that makes up the rectangle. Here is a line segment intersection detection algorithm I wrote ages ago, dredged up from one of my old XNA

Physics bodies other than my player won't call didBeginContact when colliding

a 夏天 提交于 2019-11-26 21:25:35
问题 In my game I have 4 bitmasks and everything is setup, yet didBeginContact only gets called when the first bitmask (playerCategory) collides with something. if 3 collides with 4, nothing happens, even though I have the contactTestBitMask set for them to collide. myscene.h self.physicsWorld.gravity = CGVectorMake(0.0, -2.45); self.physicsWorld.contactDelegate = self; self.player = [SKSpriteNode spriteNodeWithColor:[SKColor blueColor] size: CGSizeMake(10.0, 20.0)]; self.player.position =

iOS SpriteKit - collisions and contacts not working as expected [closed]

痴心易碎 提交于 2019-11-26 21:24:48
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . Sometimes in my SpriteKit programs, my collisions and contacts (using SKPhysicsBody) don't trigger or work as expected. I think I have set up everything I need, but I am still not getting the right interactions. How can I easily check what will collide with what and what bodies are set up to

How to fix circle and rectangle overlap in collision response?

早过忘川 提交于 2019-11-26 19:26:04
问题 Since in the digital world a real collision almost never happens, we will always have a situation where the "colliding" circle overlaps the rectangle. How to put back the circle in the situation where it collides perfectly with the rectangle without overlap? Suppose that the rectangle is stopped (null velocity) and axis-aligned. I would solve this problem with a posteriori approach (in two dimensions). In short I have to solve this equation for t : Where: is a number that answers to the

Test if two lines intersect - JavaScript function

末鹿安然 提交于 2019-11-26 19:09:58
问题 I've tried searching for a javascript function that will detect if two lines intersect each other. The function will take the x,y values of both the start end points for each line (we'll call them line A and line B). Is to return true if they intersect, otherwise false. Example of the function. I'm happy if the answer uses a vector object instead. Function isIntersect (lineAp1x, lineAp1y, lineAp2x, lineAp2y, lineBp1x, lineBp1y, lineBp2x, lineBp2y) { // JavaScript line intersecting test here.

Java ball object doesn't bounce off of drawn rectangles like it's supposed to.

六月ゝ 毕业季﹏ 提交于 2019-11-26 17:58:17
Sorry for the awful title. The purpose of the Java applet is as such: A ball is bouncing around the screen. The size and speed of this ball can be changed via scrollbars. The user can press and drag the mouse on the screen to draw rectangles. The ball will bounce off of these rectangles as well. The bounds of these rectangles are stored in a vector. When a rectangle is clicked, it (and all other rectangles at that point) are removed from the vector (and the screen). The problem I'm having is two-fold: One, when I click a rectangle to remove it, it doesn't get removed, but that can be solved

Collision detection between two rectangles in java

北城以北 提交于 2019-11-26 17:07:25
问题 I have two rectangles, the red rectangle (can move) and the blue rectangle. Both have: x, y, width, height. How can I say in a programming language such as Java when there is a collision between the blue and the red rectangle? 回答1: if (RectA.X1 < RectB.X2 && RectA.X2 > RectB.X1 && RectA.Y1 < RectB.Y2 && RectA.Y2 > RectB.Y1) Say you have Rect A, and Rect B. Proof is by contradiction. Any one of four conditions guarantees that no overlap can exist: Cond1. If A's left edge is to the right of the

CRC32 Collision

自古美人都是妖i 提交于 2019-11-26 16:05:18
问题 I am trying to find a collision between two messages that will lead to the same CRC hash. Considering I am using CRC32, is there any way I can shorten the list of possible messages I have to try when doing a brute force attack? Any links to websites with hints on this will be helpful. I already have a brute force algorithm that will do this but it simply increment integers and sees if it will match other hashes. 回答1: It depends entirely on what you mean by "message". If you can append four

Swift/SpriteKit Multiple Collision Detection?

痴心易碎 提交于 2019-11-26 16:03:26
问题 Hello. I have a multiple collision problem. There is a bullet, which hits the enemy(red rectangle). Then, it ++ the score. There is a spiral (red circle) which is supossed to trigger the scene to end when the enemy (red rectangle) touches it. In this situation, when enemy hits the spiral, it works, the scene ends, and we go to the menu screen. But, when bullet hits the enemy, the same thing happens, and I don't know why. Now, here's my code: struct PhysicsCategory { static let None : UInt32 =