Simulating an elastic bouncy ball

  • Thread starter Thread starter Alekkk
  • Start date Start date
  • Tags Tags
    Ball Elastic
AI Thread Summary
The discussion focuses on programming a realistic simulation of a bouncy rubber ball that compresses upon impact with the ground and bounces back based on spring physics. Key concepts include using Hooke's Law to relate the compression of the ball to the force exerted during the collision, as well as the conservation of energy principles that govern the ball's kinetic and potential energy during the bounce. Participants emphasize the importance of calculating the amount of squeeze, energy transfer, and the timing of these events to achieve an accurate representation of the ball's behavior. The conversation also touches on the need for a detailed, frame-by-frame analysis to depict the ball's motion and deformation throughout the bounce. Overall, the aim is to create a visually and physically accurate simulation for a game environment.
Alekkk
Messages
3
Reaction score
2
I am trying to program a game in which I have a bouncy rubber ball which upon collision with the ground, will have a squeeze factor (like a spring) and will bounce back higher due to spring physics.

I have currently been able to make a rigid bouncing ball since that simply follows the rules of rigid body collisions with conservation of momentum. What I want now is to have a ball which upon collision with the ground, squeezes a certain amount according to the balls "spring constant", force of gravity, and speed upon collision and then bounces back up according to the spring force equation. Where I am lost however is in the connection between forces, momentum, and energy. When I detect that the ball has touched the ground at a certain speed in my game, what is the next step? How do I determine how much the ball squeezes (ie spring compression), and how do I calculate the progression of the squeezing, unsqueezing, and bounce-back of the ball.

If someone could give me a rundown of a single bounce of an elastic ball with details of every step of calculation, that would be amazing!
 
  • Like
Likes Delta2
Physics news on Phys.org
Alekkk said:
If someone could give me a rundown of a single bounce of an elastic ball with details of every step of calculation, that would be amazing!
The more accurate the simulation, the more work it will be. So you will want to decide how good is good enough.

But with that said, are you familiar with Hooke’s Law? It‘s the basis for most ”good enough” analyses of elastic materials; here it will relate the force to the amount of squeezing. A second equation, ##W=Fd## relates the potential energy of the compressed ball to the amount by which it has been squeezed. Energy is conserved in an elastic collision so the sum of the potential energy and the kinetic energy is constant; the potential energy is zero (no compression) at the moment that the edge of the ball kisses the floor; the kinetic energy is zero at the moment that the ball has stopped moving down and is about to start up again.

That should be enough to get you started on an idealized ball that behaves like a Hooke’s Law spring and has all its mass concentrated in a single point at the center. More realistic and less idealized will be more work, without upper bound.
 
  • Like
Likes Alekkk
Alekkk said:
If someone could give me a rundown of a single bounce of an elastic ball with details of every step of calculation, that would be amazing!
Do you want to show the bounce of the ball in slo-mo, with an accurate representation of the speed and deformation of the ball throughout the impact?
 
  • Like
Likes Alekkk
Alekkk said:
I have currently been able to make a rigid bouncing ball since that simply follows the rules of rigid body collisions with conservation of momentum.
The momentum of a ball is reversed, not conserved in a collision with the ground. You would have to take the Earth's momentum into account to have conservation of momentum.

Do you mean conservation of energy?
 
  • Like
Likes Alekkk
Alekkk said:
Summary:: I am trying to program a game in which I have a bouncy rubber ball which upon collision with the ground, will have a squeeze factor (like a spring) and will bounce back higher due to spring physics

I am trying to program a game in which I have a bouncy rubber ball which upon collision with the ground, will have a squeeze factor (like a spring) and will bounce back higher due to spring physics.
Because of the restrictions imposed by energy conservation, the ball cannot bounce higher than a certain point unless (a) it is already moving with some speed down at that point; (b) the object with which it collides is moving up at the time of collision; (c) the "squeeze factor" as you call it releases energy at the time of collision. For example, gymnasts bend their knees as they hit a trampoline surface and then stretch them fast when the trampoline is at maximum displacement to get that extra boost.
 
  • Like
Likes Alekkk and PeroK
@kuruman Thank you for the explanation, though I mis-worded my question in that sense. I was more focused on the progression of the collision

@Nugatory Thank you! The energy conservation part actually clarifies a good bit. There is still one thing I'm unsure about though. That is, after the instant the ball "kisses" the floor, say, 0.1 second after (assuming after 0.1s it doesn't reach the point of 0 kinetic energy), how do I calculate the amount it squeezes, and the amount of energy that has been transferred?

@PeroK To your first post, yes, my goal is to show the full "slow-mo" progression of the ball as it collides with the ground, compresses, and then restores itself while bouncing back up. Since this is a game, I need to know what the ball is doing at every frame of the game.
 
kuruman said:
Because of the restrictions imposed by energy conservation, the ball cannot bounce higher than a certain point unless (a) it is already moving with some speed down at that point; (b) the object with which it collides is moving up at the time of collision; (c) the "squeeze factor" as you call it releases energy at the time of collision.
(c) could also be converting rotational into linear KE
 
  • Like
Likes Alekkk
To @Alekkk
Here is a graphic representation of a squishy bouncing ball at three different stages of the bounce (a) un-squished, (b) partially squished and (c) fully squished. You may imagine that it expands out as it is squished down to conserve mass. This effect is not shown in the picture because I suspect it's not a trivial calculation. The frame by frame displacements are sinusoidal. This is an educated guess; one would expect the dominant behavior to be harmonic.

SquashedBall.png

It was easier for me to plot this in two pieces because ##y## is double-valued. The two pieces are described by$$y_{\text{bottom}}(x,t)=\left(1-\sqrt{1-x^2}\right)\cos(t)~;~~y_{\text{top}}(x,t)=\left(1+\sqrt{1-x^2}\right)\cos(t)$$ The three calculations are at ##t=0,~0.73,~\pi/3##.

Is this what you might be looking for?
 
  • Like
Likes PeroK and Alekkk
@kuruman Oh wow thank you so much. I never thought of approaching it from the standpoint of a sinusoidal but now that I think about it, it makes perfect sense. I will try this approach and see how it goes.

I appreciate the time you took to make the model, and write out the formulas.
 
  • Like
Likes kuruman
  • #10
Alekkk said:
That is, after the instant the ball "kisses" the floor, say, 0.1 second after (assuming after 0.1s it doesn't reach the point of 0 kinetic energy), how do I calculate the amount it squeezes, and the amount of energy that has been transferred?
Something that might get you started on a not too hopelessly inaccurate simulation:
At time zero the ball just barely contacts the floor. Some short time later it will be compressed by an amount ##\Delta x##; calculate the force required to achieve that compression; from there you can appoximate the amount of kinetic energy that was converted to potential energy; that gives you the velocity change during the compression; and from there you can get to the time ##\Delta t## it takes to compress the ball by that amount ##\Delta x## from teh original uncompressed state. Now you have the speed, energy, and compression at time ##t+\Delta t## so... wash, rinse, repeat. Choose ##\Delta x## small enough that you get a large number of steps across each bounce and you'll have a simulation good enough for a game.
 
  • Like
Likes Alekkk
  • #11
kuruman said:
You may imagine that it expands out as it is squished down to conserve mass. This effect is not shown in the picture because I suspect it's not a trivial calculation.
It definitely expands laterlaly to approximately preserve the volume. But it is also not symmetrical: the impact side is much flatter:

 
  • Like
Likes Alekkk
Back
Top