Comments (4)
Also I didn't quite get the VelocityIterationCount.
- As far as I understood, the substepcount is simply how many solver/velocityIntegration pairs are executed for every CollisionDetection step.
- (because the solver is somehow cheaper than CollisionDetection and can get away with older contact points)
- Why would you split up the velocity integration in smaller parts, if the forces don't change inbetween?
from bepuphysics2.
- We also had simulated surface velocities by modifying the angular and linear velocity before the solver ran and restoring the normal ones afterwards (before the position integrator)
- How can this be done now, since integration and solving is now tied together and I can't find a callback inbeen them?
from bepuphysics2.
I could reproduce this with a modified version of the Colosseum Demo, in which I put our cubestacks: old - new
In the newer version of the demo, the provided SolveDescription
only allows the solver to use 1 velocity iteration. In the older version, it uses the default of 8. If the velocity iteration count is increased in the SolveDescription
to 8 to match the old version, it works as expected.
For reference, 2.3's Solver.IterationCount
and 2.4's Solver.VelocityIterationCount
are the same thing. I just renamed it since IterationCount
alone could be a bit ambiguous with SubstepCount
. VelocityIterationCount
refers to the number of velocity solving passes constraints undergo in a single (sub)step. Each velocity solve brings body velocities closer to obeying all their connected velocity constraints.
As far as I understood, the substepcount is simply how many solver/velocityIntegration pairs are executed for every CollisionDetection step.
That's correct; it executes multiple solves and integration steps. The integration steps also include position integration, though.
(because the solver is somehow cheaper than CollisionDetection and can get away with older contact points)
The savings is in 1) not having to re-run collision detection every substep, 2) a tighter bundling of execution that avoids thread sync points, and 3) more efficient memory access patterns.
Why would you split up the velocity integration in smaller parts, if the forces don't change inbetween?
They do change.
See the substepping documentation for more information: https://github.com/bepu/bepuphysics2/blob/master/Documentation/Substepping.md
We also had simulated surface velocities by modifying the angular and linear velocity before the solver ran and restoring the normal ones afterwards (before the position integrator)
How can this be done now, since integration and solving is now tied together and I can't find a callback inbeen them?
If you are using only one substep, the execution flow is extremely similar to 2.3's PositionLastTimestepper
. The frame goes like this (check https://github.com/bepu/bepuphysics2/blob/master/BepuPhysics/DefaultTimestepper.cs for details):
- attempt sleeps
- predict needed bounding boxes (this invokes velocity integration for the full frame timestep duration, but does not mutate body velocities)
- detect collisions
- integrate velocities
- solve constraints
- integrate positions with new velocities
- Incremental optimization
The DefaultTimestepper
doesn't expose a callback between 5 and 6 since they're both within the Simulation.Solve
call, but you could create a custom ITimestepper
that does or hook the Solver.SubstepEnded
event (see below).
Also, rather than resetting the velocity before the position integration, you could simply reset the position afterwards. Whichever's simpler and works for what you need.
If you are using more than one substep, things get a little trickier. The second substep and beyond will do position integration for the previous substep at the start of the current substep, and the Solver
exposes a SubstepStarted
and SubstepEnded
event. So the call to Simulation.Solve
for 3 substeps could conceptually look like:
SubstepStarted(0)
- integrate velocities
- solve constraints
SubstepEnded(0)
SubstepStarted(1)
- integrate positions, and then integrate velocities
- solve constraints
SubstepEnded(1)
SubstepStarted(2)
- integrate positions, and then integrate velocities
- solve constraints
SubstepEnded(2)
- integrate positions after substepping
By hooking the SubstepEnded
event, you could reset velocities. Note that, when the timestep is given an IThreadDispatcher
, the SubstepStarted
/SubstepEnded
events are called from thread 0 in the IThreadDispatcher
. Using that same IThreadDispatcher
instance from within those events would require that the IThreadDispatcher
implementation is reentrant, which the built in ThreadDispatcher
is not.
from bepuphysics2.
Thanks. We are only using one substep, so the first suggestion worked.
For reference, 2.3's Solver.IterationCount and 2.4's Solver.VelocityIterationCount are the same thing
Ahh, now I understand.
from bepuphysics2.
Related Issues (20)
- I'm confused here,ref manifoldWide from ConvexHullPairTester.cs is not a Vector<Convex4ContactManifoldWide> HOT 4
- no collision with mesh colliders HOT 7
- Body always sleeping HOT 2
- Does this mean that when end_point0 =new EdgeEndpoints(){A=0,B=3}, end_point1 =new EdgeEndpoints(){A=1,B=2}, their hash values are equal HOT 2
- The change in tree cost is an invalid value, strongly implying the tree bounds have been corrupted by infinites or NaNs. HOT 7
- Cylinder Convex Hull Tester HOT 9
- bug: endless loop when create ConvexHull HOT 3
- support multihread tracing which export chrome tracing format data HOT 2
- Broad and Narrow Phase HOT 1
- `Tree.BinnedBuild` multithreaded determinism options HOT 1
- Debug assert with wrong resolution. HOT 3
- Is there any way to bring the api level down to C#8.0 HOT 1
- How should sensors be implemented? HOT 1
- When will version 2.5 be released? HOT 6
- Cube/Plane not Simulating in ECS-based Physics Setup HOT 7
- Sleeper exhibits performance cliff at >4,000,000 active bodies HOT 1
- Initializing big compound with only 1 member results in some weird internal tree error. HOT 2
- Consider incremental tree refines on insertion HOT 1
- Instability caused by ApplyImpulse HOT 1
- Tree metanodes contain obsolete data
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 bepuphysics2.