Comments (4)
Hello,
I was looking into this and I think the code is actually correct and the article isn't. An error crept in when going from eq 12 to eq 14:
The 4 was replaced by a 2 by accident.
If you make the code in the article readable by adding newlines you can see that it does the correct thing by using (H/2)^2 = H^2/4:
float temp1 = capsuleHeight*0.5f;
float temp2 = temp0 + hsM*(temp1*temp1 + 3.0f*oneDiv8*capsuleHeight*capsuleRadius);
from joltphysics.
It seems you're right, and looking through the article comments someone else pointed out the same mistake. They mention that the sample code is correct, so it was just the final equation. Might be useful to add a comment where you reference the article mentioning the error.
I'm writing some tests for my own inertial computations, I'll see if I can write one comparing a mesh approximation of a capsule, which should hopefully fully verify whether it's correct. I also tried looking at PhysX's capsule inertia implementation, but that proved fruitless as their math is way off. (in this function if you're curious)
from joltphysics.
After creating a capsule mesh and computing the inertia from the mesh, I can confirm that the sample code (and correcting the equation to use H^2/4) does give the correct result. It's at least comforting to know that appears to be the only mistake made in the article.
I'll go ahead and close this issue, though as stated earlier it may be useful to have a comment noting the error in the original reference.
from joltphysics.
I'll go ahead and close this issue, though as stated earlier it may be useful to have a comment noting the error in the original reference.
Done.
from joltphysics.
Related Issues (20)
- Building with clang using ninja on windows HOT 5
- Use standard types HOT 2
- SixDOFConstraint needs to be able to have non-symmetrical rotation limits
- Toggling manifold reduction doesn't result in any contact callbacks HOT 2
- Mouse input is too sensitive when running samples on a remote machine over Parsec HOT 5
- [Feature Request] Soft-soft collisions and self-collisions HOT 3
- MeshShape: SaveBinaryState and sRestoreFromBinaryState dont work like intended HOT 2
- Performance regression with 9d63f5a2d1b9e426a54dce6c8979e22ff6004eba HOT 9
- [Feature Request] Compute gyroscopic forces HOT 5
- Speculative contact distance affects sensors HOT 1
- Core.h wasn't updated to reflect on the new version HOT 1
- Jolt Complilation Fails on Manjaro Linux HOT 2
- Soft bodies assert when colliding with ragdolls HOT 4
- Should BodyInterface::MoveKinematic check for SucceededAndIsInBroadPhase ? HOT 2
- Weird angular impulse behaviour (rotational inertia)
- The simulation runs too fast HOT 2
- Build fails using default CMakeLists HOT 4
- Soft bodies elicit a collision response from sensors HOT 1
- Collision with degenerate line triangle HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joltphysics.