diff options
author | Josh Jones <kilauea.jones@gmail.com> | 2021-03-22 20:10:11 -0700 |
---|---|---|
committer | Josh Jones <kilauea.jones@gmail.com> | 2021-03-22 20:10:11 -0700 |
commit | 9aadd0cde71cfe63cd10077266d8a59dad2647f6 (patch) | |
tree | 3730cd2657c53dcae982361f9066ba5ea8039e6a /scene/resources/particles_material.cpp | |
parent | 03392009725b1a81928865d4f382a2de79e65f54 (diff) |
[Godot Physics]: Correct typo in moment of inertia calculations.
The moment of inertia calculation for BoxShape is:
```
Vector3(
(p_mass / 3.0) * (ly * ly + lz * lz),
(p_mass / 3.0) * (lx * lx + lz * lz),
(p_mass / 3.0) * (lx * lx + ly * ly));
```
where the final line includes both the x and y extents.
However, for CapsuleShape3D, CylinderShape3D, ConvexPolygonShape3D, ConcavePolygonShape3D, and HeightMapShape3D, the final line read `(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y)`. I believe this is a mistake, considering the comment in each case mentions using an AABB approximation, which should follow the same approach as BoxShape.
This change corrects the final line to include both the x and y components of the shape's extent.
Diffstat (limited to 'scene/resources/particles_material.cpp')
0 files changed, 0 insertions, 0 deletions