collision

2D Elastic Ball Collision Physics

为君一笑 提交于 2020-01-12 16:10:00
问题 I am making a program that involves elastic ball physics. I have worked out all of the maths for collision against walls and stationary objects, but I cannot figure out what happens when two moving balls collide. I have mass and velocity (x and y velocity to be exact, but velocity of each ball and their direction will do) and would like the formulae for those. Remember - this is a perfectly elastic collision - so no spinning balls, etc. 回答1: This wikipedia article provides a formula to

2D Elastic Ball Collision Physics

这一生的挚爱 提交于 2020-01-12 16:07:14
问题 I am making a program that involves elastic ball physics. I have worked out all of the maths for collision against walls and stationary objects, but I cannot figure out what happens when two moving balls collide. I have mass and velocity (x and y velocity to be exact, but velocity of each ball and their direction will do) and would like the formulae for those. Remember - this is a perfectly elastic collision - so no spinning balls, etc. 回答1: This wikipedia article provides a formula to

md5 hash collisions.

落花浮王杯 提交于 2020-01-12 14:26:35
问题 If counting from 1 to X, where X is the first number to have an md5 collision with a previous number, what number is X? I want to know if I'm using md5 for serial numbers, how many units I can expect to be able to enumerate before I get a collision. 回答1: Theoretically, you can expect collisions for X around 2 64 . For a hash function with an output of n bits, first collisions appear when you have accumulated about 2 n/2 outputs (it does not matter how you choose the inputs; sequential integer

md5 hash collisions.

醉酒当歌 提交于 2020-01-12 14:25:46
问题 If counting from 1 to X, where X is the first number to have an md5 collision with a previous number, what number is X? I want to know if I'm using md5 for serial numbers, how many units I can expect to be able to enumerate before I get a collision. 回答1: Theoretically, you can expect collisions for X around 2 64 . For a hash function with an output of n bits, first collisions appear when you have accumulated about 2 n/2 outputs (it does not matter how you choose the inputs; sequential integer

Colision detection p5.js

若如初见. 提交于 2020-01-11 11:55:10
问题 just trying to make a simple pong game in p5.js. I have very recently gotten into JavaScript and can't manage to figure out collision detection between the ball and the bat. I have tried a few ways of doing it but it mostly just stopped my code from running.. etc.. would love any help! Here is my source code: function setup() { createCanvas(750, 750); } var x = 50; var y = 50; var direction = 5; var arrow = 0; var ball; var bat; function draw() { background(220); fill ('white'); ball =

Box2D: How to get the position of a sensor?

我怕爱的太早我们不能终老 提交于 2020-01-06 16:50:50
问题 Edit I've updated this question here: Box2D: How to get the position of a static body? I'm using sensors in a Box2D project. On a collision with a sensor, I'd like to know the sensor's position in the world. I'm detecting the collision with a contact listener, but the sensor's position is always 0 0. From my code: (edit, added the whole class) public class MyContactListener extends b2ContactListener { public var onSensorEvent:Function; override public function BeginContact(contact:b2Contact)

Java Pong ball glides on paddle

无人久伴 提交于 2020-01-06 08:15:42
问题 im making a pong game in java, i've run into a problem. The bug is that when the pong ball intersects with either the AI or player paddles, the ball will sometimes collide multiple times. It basically looks like like the ball is gliding on the paddle. Sometimes, the ball will even get stuck behind the paddle infinitely. Had anyone ever encountered this error or something similar? I am confused with this multiple collision stuff :( my ball class is below: package ponggame; import java.awt.*;

ARKit Ball Pass through Torus hole collision detection

前提是你 提交于 2020-01-06 06:35:19
问题 I have one ball node and one SCNTorus I am able to pass ball thorough torus node. I have added collision and I am able to detect collision when ball pass through the torus using SCNPhysicsContactDelegate But public func physicsWorld(_ world: SCNPhysicsWorld, didEnd contact: SCNPhysicsContact) called multiple times. public func physicsWorld(_ world: SCNPhysicsWorld, didEnd contact: SCNPhysicsContact) { // print("Ended collision ") print(contact.nodeA.name) print(contact.nodeB.name) print(world

Collision on X axis means 0 movement in Y axis

三世轮回 提交于 2020-01-06 02:54:25
问题 I'm developing a platformer in Unity using the 2D engine. I have my player character which has a BoxCollider2D and a RigidBody, and a number of 'walls' which have BoxColliders. Now, I copied the script for moving the player from another project and made some changes. The part which has to do with movement is as follows: public void FixedUpdate() { physVel = Vector2.zero; // move left if(Input.GetKey(KeyCode.LeftArrow)) { physVel.x = -runVel; } // move right if(Input.GetKey(KeyCode.RightArrow)

Collision on X axis means 0 movement in Y axis

為{幸葍}努か 提交于 2020-01-06 02:54:05
问题 I'm developing a platformer in Unity using the 2D engine. I have my player character which has a BoxCollider2D and a RigidBody, and a number of 'walls' which have BoxColliders. Now, I copied the script for moving the player from another project and made some changes. The part which has to do with movement is as follows: public void FixedUpdate() { physVel = Vector2.zero; // move left if(Input.GetKey(KeyCode.LeftArrow)) { physVel.x = -runVel; } // move right if(Input.GetKey(KeyCode.RightArrow)