1
votes

I writing a program in C++ using OpenGL/win32 of a ball that bounces when it's dropped from a height above either of the planes/platforms you see below.

I use plane sphere intersection and plane-sphere collision to make the ball fall/bounce accordingly (not a bounding box).

I'm now hoping to make the ball roll over the edge of the plane like it would in reality if more than half the ball is over the edge.

I was wondering what other forces I would need to simulate and how that can be implemented? I currently only simulate gravity based on the y-axis and a velocity for the return of the bounce.

As things stand, the ball can go right to the edge of the plane and as it slowly moves away, it will drop a little the further right it goes, but still remains on the platform until there's no-longer a collision. (I hope that makes sense). I've screen shot these images to try to show it:

On the edge, before it should fall:

On edge

Still on edge, but should be falling (although dropped slightly):

Still on edge

Drops only after the far left of the sphere is no-longer touching the plane:

Drops

1
Are you using physics on the actual sphere itself or it's bounding box? - PaulG
The concept you are alluding to is called the p-delta effect en.wikipedia.org/wiki/P-Delta_Effect basically it occurs when the base of something is supported, but the center of gravity is eccentric. This causes a moment about the base of the object and thus the object falls over (or in the case of your sphere, it falls off the edge). - Cory Kramer
It's the actually sphere. The sphere does drop slightly as it goes over the edge. Oh, that's awesome. I was wondering what the actual name was. Thanks for posting the link. I'll check it out. - Reanimation
If you are not writing your own, find a good physics engine instead of doing it by hand - Felice Pollano
I was hoping to try an implement it myself as a way of self learning. I have a physics book for programmers but unfortunately this seems to be the only thing it doesn't mention. Thanks for posting. - Reanimation

1 Answers

0
votes

The concept you have to introduce is the Torque, moment or moment of force. which in computing is often reference as torque.

enter image description here