Skip to main content

rapier_rope/
lib.rs

1//! Reference-space rope definitions, native construction and world-bound registration.
2//!
3//! Enable exactly one precision feature. The caller owns the world and stepping.
4//!
5//! ```
6//! use rapier_rope::{build_rope, CollisionSettings, NativeRopeMaterial,
7//!     RopeSpec, SamplingSettings, SpringSettings};
8//! let spec = RopeSpec::new("cable", vec![[0.0; 3], [1.0, 0.0, 0.0]],
9//!     NativeRopeMaterial::new(0.1, SpringSettings::new(500.0, 1.0),
10//!         SpringSettings::new(20.0, 0.8)),
11//!     SamplingSettings::new(1.0 / 32.0), CollisionSettings::new(0.005));
12//! let (native, samples, specification) = build_rope(&spec)?.into_parts();
13//! let mut world = rapier_rope::rapier::prelude::PhysicsWorld::new();
14//! let handle = world.insert_soft_body(native);
15//! assert_eq!(samples.reference_length_m(), 1.0);
16//! # Ok::<(), rapier_rope::RopeError>(())
17//! ```
18
19#[cfg(all(feature = "f32", feature = "f64"))]
20compile_error!("rapier-rope: enable exactly one of `f32` or `f64`, not both");
21#[cfg(not(any(feature = "f32", feature = "f64")))]
22compile_error!("rapier-rope: enable exactly one of `f32` or `f64`");
23
24#[cfg(feature = "f32")]
25pub use rapier_f32 as rapier;
26#[cfg(all(feature = "f64", not(feature = "f32")))]
27pub use rapier_f64 as rapier;
28
29#[cfg(any(feature = "f32", feature = "f64"))]
30pub mod attachment;
31#[cfg(any(feature = "f32", feature = "f64"))]
32pub mod builder;
33#[cfg(any(feature = "f32", feature = "f64"))]
34pub mod command;
35pub mod diagnostics;
36pub mod error;
37#[cfg(any(feature = "f32", feature = "f64"))]
38pub mod harness;
39#[cfg(any(feature = "f32", feature = "f64"))]
40pub mod harness_output;
41pub mod id;
42pub mod model;
43#[cfg(any(feature = "f32", feature = "f64"))]
44pub mod output;
45pub mod sampling;
46#[cfg(any(feature = "f32", feature = "f64"))]
47pub mod set;
48
49#[cfg(any(feature = "f32", feature = "f64"))]
50pub use attachment::{AttachmentCommand, AttachmentPreparation, LocatedSample};
51#[cfg(any(feature = "f32", feature = "f64"))]
52pub use builder::{RopeBuild, build_rope};
53#[cfg(any(feature = "f32", feature = "f64"))]
54pub use command::{CreatedAttachment, PreparedStep, RopeCommand};
55pub use diagnostics::*;
56pub use error::{RopeError, RopeErrorKind};
57#[cfg(any(feature = "f32", feature = "f64"))]
58pub use harness::*;
59#[cfg(any(feature = "f32", feature = "f64"))]
60pub use harness_output::HarnessSnapshot;
61pub use id::{AttachmentHandle, HarnessHandle, RopeHandle, RopeSetId, WorldId};
62pub use model::*;
63#[cfg(any(feature = "f32", feature = "f64"))]
64pub use output::*;
65pub use sampling::{ResolvedLocation, SampledRope, sample_rope};
66#[cfg(any(feature = "f32", feature = "f64"))]
67pub use set::{
68    AttachmentView, RegistryPhase, RemovedRope, RopeSet, RopeSetError, RopeSetErrorKind,
69    RopeStepObservation, RopeView, StepReport,
70};