# How is rolling ball physics set up?

**URL:** <https://forum.kirupa.com/t/how-is-rolling-ball-physics-set-up/50501>\
**Category:** programming\
**Created:** [May 3, 2004, 7:10pm UTC](https://forum.kirupa.com/t/how-is-rolling-ball-physics-set-up/50501 "2004-05-03T19:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![O\_M](https://avatars.discourse-cdn.com/v4/letter/o/848f3c/32.png) [@O\_M](https://forum.kirupa.com/u/O_M)\
**Post date:** [May 3, 2004, 7:10pm UTC](https://forum.kirupa.com/t/how-is-rolling-ball-physics-set-up/50501/1 "2004-05-03T19:10:41Z")

</div>

Ive been looking around, but cant seem to find the formula described for a rolling ball slowing down including the gravity factor (9.81) a given friction and mass (kg). The surface would be 100% flat.

Does anyone know how it is set up? For instance in this example a ball rolling over the X axis in + direction (in other words degree 0 if im not mistaken)).

```auto

onClipEvent (enterframe) {
	if (!stop) {
		speed -= formula for slowing down;
		_x += speed;
		if (speed < 1) {
			stop = true;
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 4, 2004, 3:35pm UTC](https://forum.kirupa.com/t/how-is-rolling-ball-physics-set-up/50501/2 "2004-05-04T15:35:17Z")

</div>

Thanks 😉

And concerning the rolling ball physics, as you call it, if the ground is 100% flat, mass has absolutely no influence (because the reaction of the ground is the exact opposite of the force created by the mass), only friction matters:

```auto
damp = .95 ;
theBall.speed = 10 ;
theBall.onEnterframe = function () {
	this._x += this.speed ;
	speed *= damp ;
}

```
