ball

Ball to Ball Collision - Detection and Handling

With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator. You click and drag the mouse to launch a ball. It will bounce around and eventually stop on the "floor". My next big feature I want to add in is ball to ball collision. The ball's movement is broken up into a x and y speed vector. ...

Using an epsilon value to determine if a ball in a game is not moving?

I have balls bouncing around and each time they collide their speed vector is reduced by the Coefficient of Restitution. Right now my balls CoR for my balls is .80 . So after many bounces my balls have "stopped" rolling because their speed has becoming some ridiculously small number. In what stage is it appropriate to check if a spee...

Bouncing Ball in Java

This is probably a really basic problem but I can't seem to find any other articles on it. Anyway, I have written a small bouncing ball program in Java to try and expand my basic skills. The program is just a simple bouncing ball that will drop and hopefully bounce for a while. The original program worked fine but now I have tried to ad...

How do I create collision detections for my bouncing balls?

I have coded an animation (in python) for three beach balls to bounce around a screen. I now wish to have them all collide and be able to bounce off each other. I would really appreciate any help that can be offered. import pygame import random import sys class Ball: def __init__(self,X,Y): self.velocity = [1,1] s...

How do I reverse the direction that my rectangles travel?

I am very new at programming as it was only just introduced into my school as a subject and I need some help. I have been given the task to have an animation of three balls (rectangle images) bouncing around the screen and off each other. I have the three balls and the bouncing of the walls all down good, but I don't know how to have the...

Bouncing ball not conforming to Conservation of Energy Rule!!!

Hi all, I am currently busy on writing a small ball physics engine for my programming course in Win32 API and c++. I have finished the GDI backbuffer renderer and the whole GUI (couple of more things to adjust) but i am very near to completion. The only big obstacles that last are ball to ball collision (but i can fix this on my own) but...

Ball to Ball Collision - Gains significant velocity upon collision

I implemented the code from the question "Ball to Ball Collision - Detection and Handling" in Objective-C. However, whenever the balls collide at an angle their velocity increases dramatically. All of the vector math is done using cocos2d-iphone, with the header CGPointExtension.h. What is the cause of this undesired acceleration? The f...

2D Ball Collisions with Corners

I'm trying to write a 2D simulation of a ball that bounces off of fixed vertical and horizontal walls. Simulating collisions with the faces of the walls was pretty simple--just negate the X-velocity for a vertical wall or the Y-velocity for a horizontal wall. The problem is that the ball can also collide with the corners of the walls, ...

mouse indicator speed

I opened up a ball mouse and saw the slotted disks which turn past the light collectors. Where can I find code to capture, or see in a Windows program the speed that these slots are being detected as the mouse ball moves? I am trying to write a VB6 program which tells me the speed (slots past the collector per second) that the disk is t...

Are there any ball tracking algorithms/patterns around in game programming

Hello, I am a newbie to game programming,I would need the suggestions and help of the wonderful people around here. I have set of players, and a ball, the players can kick the ball around the ground (not yet a football game, neither a foosball game too ).Are there any algorithms/ patterns for addressing the problems with tracking the b...

2D colliding n-body simulation (fast Collision Detection for large number of balls)

Hello I want to write a program for simulating a motion of high number (N = 1000 - 10^5 and more) of bodies (circles) on 2D plane. All bodies have equal size and the only force between them is elastic collision. I want to get something like but in larger scale, with more balls and more dense filling of the plane (not a gas model as he...

2D Gaming - How to reflect a ball off the bat?

Hi there I am pretty new to XNA & game dev and am stuck at ball reflection. My ball is reflecting once it hits the bat, but only in one angle, no matter which angle the bat is at. Here's the code: if (BallRect.Intersects(BatRect)) { Vector2 NormBallVelocity = Ball.velocity; NormBallVelocity.Normalize(); Norm...

Ball rolling sound effect

I am working on a Labyrinth style app for iPhone using Chipmunk and openAL. I got everything working except the ball rolling sound. What I have tried is playing a small sound for each update in the ball's position so that the overall effect sounds like the ball is rolling. Based on advice on this forum I tired using velocity of the ball ...

How to make a ball move along the edge of a rotating rectangle in xcode?

I wish to make a lever and rotate the lever using accelerometer. I have this problem trying to place the ball on top of the lever and slide the ball along the lever according to the rotation. Would anyone drop me some hints or refer me to sample codes? ...

How to handle ball to ball collision with trigonometry instead of vectors?

I am making a simplified version of the ball physics app found at this SO question. I gained a lot from reading through the code and links provided at that question, but in my program I do not use vectors, I just update the coordinates of my balls (each of which has a random angle and speed) with trigonometry functions when they hit the...

Calcuate x/y point that 2 moving balls will collide

Im trying to make what is (essentially) a simple pool game, and would like to be able to predict where a shot will go once it hits another ball. The first part is, I believe, to calculate if the cueball will hit anything, and if it does, where it collides. I can work out collision points for a line and a ball, but not 2 balls. So given...

Simple iPhone accelerometer ball-maze game

I want to make a simple 2D game where the user has to navigate a ball through a maze (using the accelerometer of course). I used a simple view to make use of the accelerometer and move a ball on the screen. Now how do I go about building the maze? Would I have to use cocos2d or something similar? How do I make the ball stop or rebound wh...