Simulating two circles bouncing off each other
问题 I have many particles moving around and hit detection to see when they touch. If two particles touch they should bounce off in the opposite direction. particle.moveSelf = function() { var radians = this.angle * Math.PI / 180; var moveX = this.velocity * Math.sin(radians); var moveY = this.velocity * Math.cos(radians); for (var i = 0; i < particles.length; i++) { var distance = this.position.getDistance(new Point(particles[i].position.x, particles[i].position.y)); //if distance < radius 1 +