Comments (6)
Mmh, it is right that nphysics is free of units. I also think that using f64
is not viable because the scalar type used by nphysics could very well be greater than 64-bits (because the user could use decimal d128
types once they support more math operations).
So after some thought I think it is best to simply deprecate t
and leave it to the user to track the time as he wishes. nphysics itself does not use this t
anyway.
Edit: I've seen the discord conversation just now. It appears the removal of t has been suggested by other contributors too.
from nphysics.
It might make sense to convert the time related values to use std::time
structs which should handle a much larger time period.
https://doc.rust-lang.org/std/time/struct.Instant.html
from nphysics.
Hi! What exactly do you mean by "the mechanical world stops ticking correctly"? What behavior are you observing and what is your setup?
While nphysics does maintain the total elapsed time in the IntegrationParameters::t
variable, it is never used for the simulation itself. So even large running times should not affect the simulation itself.
from nphysics.
Ok so I am using IntegrationParameters::t
to keep the sim in sync with real time.
let start = time::Instant::now();
...
while mechanical_world.integration_parameters.t < start.elapsed().as_secs_f32() {
let real_elapsed = start.elapsed().as_secs_f32();
let sim_elapsed = mechanical_world.integration_parameters.t;
if real_elapsed - sim_elapsed > 0.5 {
warn!("Jerk to catch up - real: {:?}, sim: {}", real_elapsed, sim_elapsed );
}
mechanical_world.tick(...);
}
So when IntegrationParameters::t
stops updating I get stuck in an infinite loop. I could just stop relying on it but it seems like a limitation? Would it be possible to just make the type of t
defined as an f64
rather than tied to the rest of the sims type?
from nphysics.
Oh, I see. In that case we should change t
to use std::time::Duration as you suggested instead.
from nphysics.
I can make a PR.
It was pointed out on discord that it might be best to avoid std::time
as we might want to keep nphysics free of units. std::time::Duration
uses a mix of u64
and u32
to go up to billions of years and down to nanoseconds.
pub struct Duration {
secs: u64,
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC
}
Is this good enough or should it just be changed to an f64
?
from nphysics.
Related Issues (20)
- v0.13 doesn't build with wasm_bindgen HOT 3
- Testbed `look_at()` method doesn't seem to center the camera at the location given HOT 3
- Very slow on macos HOT 3
- Panic "Invalid parent body part handle" when creating and deleting a body in the same frame
- A doc issue, let joint = RevoluteJoint::new(-0.1); needs to update
- Custom Broadphase Collision Filters HOT 2
- Rigidbody velocity gets improperly clamped if a max_linear_velocity is set HOT 2
- Contact between a ball and cuboid sometimes and has no contact pair HOT 2
- Update nalgebra dependency to latest version (0.21.0) HOT 2
- Expose nalgebra and ncollide through nphysics HOT 3
- 2d: Moving an object over many ground boxes with width 1, sometimes cause the object to sometimes fly off in the Y-direction? HOT 2
- Is there an example that works with wgpu HOT 3
- URDF, SDF, MJCF Model Loading HOT 7
- Broad phase pair filters cannot access body information HOT 2
- Until `MechanicalWorld::step` is called, `GeometricalWorld::interferences_with_point` uses old collider positions HOT 1
- Wrong inertia calculation in `<RigidBody<N> as BodyPart<N>>::add_local_inertia_and_com`
- FEMVolume `renumber_dofs` breaks kinematic indices
- Can't build examples HOT 1
- When will the new features like 'physx5.0' be supported? such as 'Soft Body Dynamics'、'Cloth'、'PBF'、'...'
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 nphysics.