Comments (2)
Thanks for this post. I wrote that code ages ago... And it looks buggy. Here is what I use in my qu3e repo, which should be robust.
// Artificial axis bias to improve frame coherence
const r32 kRelTol = r32( 0.95 );
const r32 kAbsTol = r32( 0.01 );
i32 axis;
r32 sMax;
q3Vec3 n;
r32 faceMax = q3Max( aMax, bMax );
if ( kRelTol * eMax > faceMax + kAbsTol )
{
axis = eAxis;
sMax = eMax;
n = nE;
}
else
{
if ( kRelTol * bMax > aMax + kAbsTol )
{
axis = bAxis;
sMax = bMax;
n = nB;
}
else
{
axis = aAxis;
sMax = aMax;
n = nA;
}
}
So then to update our function here (no edge case, just two faces), it can look like:
inline bool BiasGreaterThan( real a, real b )
{
const real k_relative = 0.95f;
const real k_absolute = 0.01f;
if (k_relative * a > b + k_absolute) {
return true;
} else {
return false;
}
}
Would you like to submit a pull request? If not I can make the modification. Let me know!
from impulseengine.
Wow thanks for the quick response! Your modification also fixes the issue. No more false negative intersections. However, I'm still experimenting with the bias in my engine (currently have sequential impulse solver+feature based contacts+warm starting working) to determine what is most stable. Interestingly enough, your original bias implementation was very stable with my stacking test cases (essentially just squares stacked in different nxm configurations). But I've come to realize that it is very dependent on the order of my pairs from the broadphase as this affects the distribution of the bias on each body. For example, when I add the bodies to the world in a reverse order, then the original bias becomes more unstable.
Anyway, your change does indeed fix the bug of missing intersections, which was the most critical issue. So you can feel free to make the modification. I'm going to continue to experiment in my own engine with different biases to determine which is most stable.
from impulseengine.
Related Issues (10)
- Manifold::Initialize() sqrt of square not required? HOT 2
- randygaul.net is down. HOT 1
- order of selection of vertices and order of calculating face normal in CircleToPolygon() do not match
- ‘dt’ undeclared
- Wrong friction calculation? HOT 1
- Multiple Contact Point Bug HOT 4
- Repeat simulation with different dt
- About Compilation on Windows HOT 1
- Circle friction not working as intended? Circle never gets any slower. HOT 3
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 impulseengine.