Need help for computer science coursework - motion and gravity

AI Thread Summary
To simulate the motion of a ball in a pinball game, the key is to apply Newton's Second Law, which states that acceleration (a) is equal to force (F) divided by mass (m). For gravity, with a constant acceleration of 25 L/ms², the acceleration vector can be directly updated each tick. The process involves adding the acceleration vector to the velocity vector, and then adding the velocity vector to the position vector for each tick. It's important to reset the acceleration vector each frame to avoid accumulating values incorrectly. Finally, speed and angle can be derived from the velocity vector, with speed being its magnitude and angle representing its direction.
gutti
Messages
26
Reaction score
0
I'm not a physics student and haven't done any physics work since high school. I've since then forgot most of what I knew and although while researching this problem, everything looks familiar. It just doesn't fit together in my head. This isn't a marked piece of the coursework it's just involved and the coursework really doesn't work without it.

I am making a pinball simulation and need to calculate the motion of a ball. At all times I can get the coordinates of the ball (which I don't think really matter, the velocity(speed and angle of movement) and I am given a value for gravity which is 25 L/ms^2 where L is some unit of distance.

On each tick of the program the ball will move and then gravity must be applied to it.

I need to calculate the new angle the ball will be moving at and the new speed of the ball.

Could someone tell me which equations I would use to calculate this.
 
Physics news on Phys.org
This isn't really the section of the forums to ask this, but I'm happy to answer it anyway. Luckily motion is pretty easy to set up in a program. If you use vectors to represent position, velocity, and acceleration, it becomes quite simple.

For each tick you choose which forces to apply to which objects (in your case the pinball), and calculate the resulting acceleration from Newton's Second:
$$a = \frac{F}{m}$$
Or, in a case like gravity where acceleration will always be the same value, you can just change the acceleration vector directly.

Then, on each tick, just add the acceleration vector to the velocity vector, then add the velocity vector to the position vector. There are other ways to do it, say if you wanted to move things forward a certain time value each time, but this is the simplest, I think. Also, make sure you set the acceleration vector to null on each frame (or reset it to something like the acceleration from gravity) so that you don't accumulate values in the vector each frame.

Then you can calculate the speed and angle from the velocity vector. (Speed is the magnitude of the vector, angle is the direction of the vector)
 
Thread 'Collision of a bullet on a rod-string system: query'
In this question, I have a question. I am NOT trying to solve it, but it is just a conceptual question. Consider the point on the rod, which connects the string and the rod. My question: just before and after the collision, is ANGULAR momentum CONSERVED about this point? Lets call the point which connects the string and rod as P. Why am I asking this? : it is clear from the scenario that the point of concern, which connects the string and the rod, moves in a circular path due to the string...
Thread 'A cylinder connected to a hanged mass'
Let's declare that for the cylinder, mass = M = 10 kg Radius = R = 4 m For the wall and the floor, Friction coeff = ##\mu## = 0.5 For the hanging mass, mass = m = 11 kg First, we divide the force according to their respective plane (x and y thing, correct me if I'm wrong) and according to which, cylinder or the hanging mass, they're working on. Force on the hanging mass $$mg - T = ma$$ Force(Cylinder) on y $$N_f + f_w - Mg = 0$$ Force(Cylinder) on x $$T + f_f - N_w = Ma$$ There's also...

Similar threads

Replies
38
Views
3K
Replies
19
Views
2K
Replies
3
Views
822
Replies
8
Views
2K
Replies
18
Views
4K
Replies
7
Views
4K
Back
Top