saharan/OimoPhysics

ConeGeometry.hx (double-check one function for accuracy)

Snky opened this issue · 1 comments

Snky commented

Hello, I've seen some copies of OimoPhysics floating around, not sure which one is the best one for me to use, as I do not know how to use externs that well, but I've noticed a difference in ConeGeometry.hx

	override public function _updateMass():Void {
		var r2:Float = _radius * _radius;
		var h2:Float = _halfHeight * _halfHeight * 4;
		_volume = MathUtil.PI * r2 * _halfHeight * 2 / 3;
		M.mat3_diagonal(_inertiaCoeff,
			1 / 20 * (3 * r2 + 2 * h2),
			3 / 10 * r2,
			1 / 12 * (3 * r2 + 2 * h2)
		);
	}
	```
Where it says 1 / 12, I've seen a different version showing 1 / 20.
So alt version:
1 / 20
3 / 10
1 / 20

The latter one is correct, this is fixed in 14ddb93.
Inertia moment along both X and Z should be the same.

cf. https://scienceworld.wolfram.com/physics/MomentofInertiaCone.html