Release v0.10.0
This commit is contained in:
committed by
Sébastien Crozet
parent
9233a855f0
commit
77a6cd3f26
@@ -1,3 +1,12 @@
|
|||||||
|
## v0.10.0
|
||||||
|
### Added
|
||||||
|
- Implement `Clone` for `IslandManager`.
|
||||||
|
|
||||||
|
### Modified
|
||||||
|
- `JointSet::insert` no longer takes the rigid-body set in its arguments.
|
||||||
|
- Modify the testbed's plugin system to let plugins interact with the rendering.
|
||||||
|
- Implement `PartialEq` for most collider and rigid-body components.
|
||||||
|
|
||||||
## v0.9.2
|
## v0.9.2
|
||||||
### Added
|
### Added
|
||||||
- Make the method JointSet::remove_joints_attached_to_rigid_body public so that it can can be called externally for
|
- Make the method JointSet::remove_joints_attached_to_rigid_body public so that it can can be called externally for
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
if i > 0 {
|
if i > 0 {
|
||||||
let parent_handle = *body_handles.last().unwrap();
|
let parent_handle = *body_handles.last().unwrap();
|
||||||
let joint = BallJoint::new(Point::origin(), point![0.0, shift]);
|
let joint = BallJoint::new(Point::origin(), point![0.0, shift]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -50,7 +50,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
let parent_index = body_handles.len() - numi;
|
let parent_index = body_handles.len() - numi;
|
||||||
let parent_handle = body_handles[parent_index];
|
let parent_handle = body_handles[parent_index];
|
||||||
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0]);
|
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(0.0, shift),
|
Isometry::translation(0.0, shift),
|
||||||
);
|
);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -61,7 +61,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(-shift, 0.0),
|
Isometry::translation(-shift, 0.0),
|
||||||
);
|
);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
prism.limits_enabled = true;
|
prism.limits_enabled = true;
|
||||||
prism.limits[0] = -1.5;
|
prism.limits[0] = -1.5;
|
||||||
prism.limits[1] = 1.5;
|
prism.limits[1] = 1.5;
|
||||||
joints.insert(&mut bodies, curr_parent, curr_child, prism);
|
joints.insert(curr_parent, curr_child, prism);
|
||||||
|
|
||||||
curr_parent = curr_child;
|
curr_parent = curr_child;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
if i > 0 {
|
if i > 0 {
|
||||||
let parent_handle = *body_handles.last().unwrap();
|
let parent_handle = *body_handles.last().unwrap();
|
||||||
let joint = BallJoint::new(Point::origin(), point![0.0, 0.0, -shift]);
|
let joint = BallJoint::new(Point::origin(), point![0.0, 0.0, -shift]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -45,7 +45,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
let parent_index = body_handles.len() - num;
|
let parent_index = body_handles.len() - num;
|
||||||
let parent_handle = body_handles[parent_index];
|
let parent_handle = body_handles[parent_index];
|
||||||
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0, 0.0]);
|
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0, 0.0]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(0.0, 0.0, -shift),
|
Isometry::translation(0.0, 0.0, -shift),
|
||||||
);
|
);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -64,7 +64,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(-shift, 0.0, 0.0),
|
Isometry::translation(-shift, 0.0, 0.0),
|
||||||
);
|
);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
prism.limits_enabled = true;
|
prism.limits_enabled = true;
|
||||||
prism.limits[0] = -2.0;
|
prism.limits[0] = -2.0;
|
||||||
prism.limits[1] = 2.0;
|
prism.limits[1] = 2.0;
|
||||||
joints.insert(&mut bodies, curr_parent, curr_child, prism);
|
joints.insert(curr_parent, curr_child, prism);
|
||||||
|
|
||||||
curr_parent = curr_child;
|
curr_parent = curr_child;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
RevoluteJoint::new(o, x, point![shift, 0.0, 0.0], x),
|
RevoluteJoint::new(o, x, point![shift, 0.0, 0.0], x),
|
||||||
];
|
];
|
||||||
|
|
||||||
joints.insert(&mut bodies, curr_parent, handles[0], revs[0]);
|
joints.insert(curr_parent, handles[0], revs[0]);
|
||||||
joints.insert(&mut bodies, handles[0], handles[1], revs[1]);
|
joints.insert(handles[0], handles[1], revs[1]);
|
||||||
joints.insert(&mut bodies, handles[1], handles[2], revs[2]);
|
joints.insert(handles[1], handles[2], revs[2]);
|
||||||
joints.insert(&mut bodies, handles[2], handles[3], revs[3]);
|
joints.insert(handles[2], handles[3], revs[3]);
|
||||||
|
|
||||||
curr_parent = handles[3];
|
curr_parent = handles[3];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier2d-f64"
|
name = "rapier2d-f64"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "2-dimensional physics engine in Rust."
|
description = "2-dimensional physics engine in Rust."
|
||||||
documentation = "http://docs.rs/rapier2d"
|
documentation = "http://docs.rs/rapier2d"
|
||||||
@@ -47,8 +47,8 @@ required-features = [ "dim2", "f64" ]
|
|||||||
vec_map = { version = "0.8", optional = true }
|
vec_map = { version = "0.8", optional = true }
|
||||||
instant = { version = "0.1", features = [ "now" ]}
|
instant = { version = "0.1", features = [ "now" ]}
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
nalgebra = "0.27"
|
nalgebra = "0.28"
|
||||||
parry2d-f64 = "0.5"
|
parry2d-f64 = "0.6"
|
||||||
simba = "0.5"
|
simba = "0.5"
|
||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
rayon = { version = "1", optional = true }
|
rayon = { version = "1", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier2d"
|
name = "rapier2d"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "2-dimensional physics engine in Rust."
|
description = "2-dimensional physics engine in Rust."
|
||||||
documentation = "http://docs.rs/rapier2d"
|
documentation = "http://docs.rs/rapier2d"
|
||||||
@@ -47,8 +47,8 @@ required-features = [ "dim2", "f32" ]
|
|||||||
vec_map = { version = "0.8", optional = true }
|
vec_map = { version = "0.8", optional = true }
|
||||||
instant = { version = "0.1", features = [ "now" ]}
|
instant = { version = "0.1", features = [ "now" ]}
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
nalgebra = "0.27"
|
nalgebra = "0.28"
|
||||||
parry2d = "0.5"
|
parry2d = "0.6"
|
||||||
simba = "0.5"
|
simba = "0.5"
|
||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
rayon = { version = "1", optional = true }
|
rayon = { version = "1", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier3d-f64"
|
name = "rapier3d-f64"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "3-dimensional physics engine in Rust."
|
description = "3-dimensional physics engine in Rust."
|
||||||
documentation = "http://docs.rs/rapier3d"
|
documentation = "http://docs.rs/rapier3d"
|
||||||
@@ -47,8 +47,8 @@ required-features = [ "dim3", "f64" ]
|
|||||||
vec_map = { version = "0.8", optional = true }
|
vec_map = { version = "0.8", optional = true }
|
||||||
instant = { version = "0.1", features = [ "now" ]}
|
instant = { version = "0.1", features = [ "now" ]}
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
nalgebra = "0.27"
|
nalgebra = "0.28"
|
||||||
parry3d-f64 = "0.5"
|
parry3d-f64 = "0.6"
|
||||||
simba = "0.5"
|
simba = "0.5"
|
||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
rayon = { version = "1", optional = true }
|
rayon = { version = "1", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier3d"
|
name = "rapier3d"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "3-dimensional physics engine in Rust."
|
description = "3-dimensional physics engine in Rust."
|
||||||
documentation = "http://docs.rs/rapier3d"
|
documentation = "http://docs.rs/rapier3d"
|
||||||
@@ -47,8 +47,8 @@ required-features = [ "dim3", "f32" ]
|
|||||||
vec_map = { version = "0.8", optional = true }
|
vec_map = { version = "0.8", optional = true }
|
||||||
instant = { version = "0.1", features = [ "now" ]}
|
instant = { version = "0.1", features = [ "now" ]}
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
nalgebra = "0.27"
|
nalgebra = "0.28"
|
||||||
parry3d = "0.5"
|
parry3d = "0.6"
|
||||||
simba = "0.5"
|
simba = "0.5"
|
||||||
approx = "0.5"
|
approx = "0.5"
|
||||||
rayon = { version = "1", optional = true }
|
rayon = { version = "1", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier_testbed2d"
|
name = "rapier_testbed2d"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "Testbed for the Rapier 2-dimensional physics engine in Rust."
|
description = "Testbed for the Rapier 2-dimensional physics engine in Rust."
|
||||||
homepage = "http://rapier.org"
|
homepage = "http://rapier.org"
|
||||||
@@ -26,16 +26,16 @@ other-backends = [ "wrapped2d", "nphysics2d" ]
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.27", features = [ "rand" ] }
|
nalgebra = { version = "0.28", features = [ "rand" ] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
instant = { version = "0.1", features = [ "web-sys", "now" ]}
|
instant = { version = "0.1", features = [ "web-sys", "now" ]}
|
||||||
bitflags = "1"
|
bitflags = "1"
|
||||||
num_cpus = { version = "1", optional = true }
|
num_cpus = { version = "1", optional = true }
|
||||||
wrapped2d = { version = "0.4", optional = true }
|
wrapped2d = { version = "0.4", optional = true }
|
||||||
parry2d = "0.5"
|
parry2d = "0.6"
|
||||||
ncollide2d = "0.30"
|
ncollide2d = "0.31"
|
||||||
nphysics2d = { version = "0.22", optional = true }
|
nphysics2d = { version = "0.23", optional = true }
|
||||||
crossbeam = "0.8"
|
crossbeam = "0.8"
|
||||||
bincode = "1"
|
bincode = "1"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
@@ -54,5 +54,5 @@ bevy_webgl2 = "0.5"
|
|||||||
|
|
||||||
[dependencies.rapier2d]
|
[dependencies.rapier2d]
|
||||||
path = "../rapier2d"
|
path = "../rapier2d"
|
||||||
version = "0.9"
|
version = "0.10"
|
||||||
features = [ "serde-serialize" ]
|
features = [ "serde-serialize" ]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rapier_testbed3d"
|
name = "rapier_testbed3d"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
|
||||||
description = "Testbed for the Rapier 3-dimensional physics engine in Rust."
|
description = "Testbed for the Rapier 3-dimensional physics engine in Rust."
|
||||||
homepage = "http://rapier.org"
|
homepage = "http://rapier.org"
|
||||||
@@ -25,16 +25,16 @@ parallel = [ "rapier3d/parallel", "num_cpus" ]
|
|||||||
other-backends = [ "physx", "physx-sys", "glam", "nphysics3d" ]
|
other-backends = [ "physx", "physx-sys", "glam", "nphysics3d" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nalgebra = { version = "0.27", features = [ "rand" ] }
|
nalgebra = { version = "0.28", features = [ "rand" ] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_pcg = "0.3"
|
rand_pcg = "0.3"
|
||||||
instant = { version = "0.1", features = [ "web-sys", "now" ]}
|
instant = { version = "0.1", features = [ "web-sys", "now" ]}
|
||||||
bitflags = "1"
|
bitflags = "1"
|
||||||
glam = { version = "0.12", optional = true }
|
glam = { version = "0.12", optional = true }
|
||||||
num_cpus = { version = "1", optional = true }
|
num_cpus = { version = "1", optional = true }
|
||||||
parry3d = "0.5"
|
parry3d = "0.6"
|
||||||
ncollide3d = "0.30"
|
ncollide3d = "0.31"
|
||||||
nphysics3d = { version = "0.22", optional = true }
|
nphysics3d = { version = "0.23", optional = true }
|
||||||
physx = { version = "0.11", optional = true }
|
physx = { version = "0.11", optional = true }
|
||||||
physx-sys = { version = "0.4", optional = true }
|
physx-sys = { version = "0.4", optional = true }
|
||||||
crossbeam = "0.8"
|
crossbeam = "0.8"
|
||||||
@@ -56,5 +56,5 @@ bevy_webgl2 = "0.5"
|
|||||||
|
|
||||||
[dependencies.rapier3d]
|
[dependencies.rapier3d]
|
||||||
path = "../rapier3d"
|
path = "../rapier3d"
|
||||||
version = "0.9"
|
version = "0.10"
|
||||||
features = [ "serde-serialize" ]
|
features = [ "serde-serialize" ]
|
||||||
@@ -45,7 +45,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
if i > 0 {
|
if i > 0 {
|
||||||
let parent_handle = *body_handles.last().unwrap();
|
let parent_handle = *body_handles.last().unwrap();
|
||||||
let joint = BallJoint::new(Point::origin(), point![0.0, shift]);
|
let joint = BallJoint::new(Point::origin(), point![0.0, shift]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -53,7 +53,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
|||||||
let parent_index = body_handles.len() - numi;
|
let parent_index = body_handles.len() - numi;
|
||||||
let parent_handle = body_handles[parent_index];
|
let parent_handle = body_handles[parent_index];
|
||||||
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0]);
|
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0]);
|
||||||
joints.insert(&mut bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ fn prismatic_repro(
|
|||||||
let (stiffness, damping) = (0.05, 0.2);
|
let (stiffness, damping) = (0.05, 0.2);
|
||||||
prismatic.configure_motor_position(0.0, stiffness, damping);
|
prismatic.configure_motor_position(0.0, stiffness, damping);
|
||||||
|
|
||||||
joints.insert(bodies, box_rb, wheel_rb, prismatic);
|
joints.insert(box_rb, wheel_rb, prismatic);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put a small box under one of the wheels
|
// put a small box under one of the wheels
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ fn create_prismatic_joints(
|
|||||||
prism.limits[0] = -2.0;
|
prism.limits[0] = -2.0;
|
||||||
prism.limits[1] = 2.0;
|
prism.limits[1] = 2.0;
|
||||||
|
|
||||||
joints.insert(bodies, curr_parent, curr_child, prism);
|
joints.insert(curr_parent, curr_child, prism);
|
||||||
|
|
||||||
curr_parent = curr_child;
|
curr_parent = curr_child;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ fn create_actuated_prismatic_joints(
|
|||||||
prism.limits[1] = 5.0;
|
prism.limits[1] = 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
joints.insert(bodies, curr_parent, curr_child, prism);
|
joints.insert(curr_parent, curr_child, prism);
|
||||||
|
|
||||||
curr_parent = curr_child;
|
curr_parent = curr_child;
|
||||||
}
|
}
|
||||||
@@ -168,10 +168,10 @@ fn create_revolute_joints(
|
|||||||
RevoluteJoint::new(o, x, point![shift, 0.0, 0.0], x),
|
RevoluteJoint::new(o, x, point![shift, 0.0, 0.0], x),
|
||||||
];
|
];
|
||||||
|
|
||||||
joints.insert(bodies, curr_parent, handles[0], revs[0]);
|
joints.insert(curr_parent, handles[0], revs[0]);
|
||||||
joints.insert(bodies, handles[0], handles[1], revs[1]);
|
joints.insert(handles[0], handles[1], revs[1]);
|
||||||
joints.insert(bodies, handles[1], handles[2], revs[2]);
|
joints.insert(handles[1], handles[2], revs[2]);
|
||||||
joints.insert(bodies, handles[2], handles[3], revs[3]);
|
joints.insert(handles[2], handles[3], revs[3]);
|
||||||
|
|
||||||
curr_parent = handles[3];
|
curr_parent = handles[3];
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ fn create_fixed_joints(
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(0.0, 0.0, -shift),
|
Isometry::translation(0.0, 0.0, -shift),
|
||||||
);
|
);
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -232,7 +232,7 @@ fn create_fixed_joints(
|
|||||||
Isometry::identity(),
|
Isometry::identity(),
|
||||||
Isometry::translation(-shift, 0.0, 0.0),
|
Isometry::translation(-shift, 0.0, 0.0),
|
||||||
);
|
);
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
@@ -273,7 +273,7 @@ fn create_ball_joints(
|
|||||||
if i > 0 {
|
if i > 0 {
|
||||||
let parent_handle = *body_handles.last().unwrap();
|
let parent_handle = *body_handles.last().unwrap();
|
||||||
let joint = BallJoint::new(Point::origin(), point![0.0, 0.0, -shift * 2.0]);
|
let joint = BallJoint::new(Point::origin(), point![0.0, 0.0, -shift * 2.0]);
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal joint.
|
// Horizontal joint.
|
||||||
@@ -281,7 +281,7 @@ fn create_ball_joints(
|
|||||||
let parent_index = body_handles.len() - num;
|
let parent_index = body_handles.len() - num;
|
||||||
let parent_handle = body_handles[parent_index];
|
let parent_handle = body_handles[parent_index];
|
||||||
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0, 0.0]);
|
let joint = BallJoint::new(Point::origin(), point![-shift, 0.0, 0.0]);
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
body_handles.push(child_handle);
|
body_handles.push(child_handle);
|
||||||
@@ -348,7 +348,7 @@ fn create_actuated_revolute_joints(
|
|||||||
joint.configure_motor_velocity(-2.0, 0.1);
|
joint.configure_motor_velocity(-2.0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_handle = child_handle;
|
parent_handle = child_handle;
|
||||||
@@ -406,7 +406,7 @@ fn create_actuated_ball_joints(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
joints.insert(bodies, parent_handle, child_handle, joint);
|
joints.insert(parent_handle, child_handle, joint);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_handle = child_handle;
|
parent_handle = child_handle;
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ impl JointSet {
|
|||||||
/// Inserts a new joint into this set and retrieve its handle.
|
/// Inserts a new joint into this set and retrieve its handle.
|
||||||
pub fn insert<J>(
|
pub fn insert<J>(
|
||||||
&mut self,
|
&mut self,
|
||||||
_bodies: &mut impl ComponentSetMut<RigidBodyIds>, // FIXME: remove this argument, this is no longer necessary.
|
|
||||||
body1: RigidBodyHandle,
|
body1: RigidBodyHandle,
|
||||||
body2: RigidBodyHandle,
|
body2: RigidBodyHandle,
|
||||||
joint_params: J,
|
joint_params: J,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub struct QueryPipeline {
|
|||||||
serde(skip, default = "crate::geometry::default_query_dispatcher")
|
serde(skip, default = "crate::geometry::default_query_dispatcher")
|
||||||
)]
|
)]
|
||||||
query_dispatcher: Arc<dyn QueryDispatcher>,
|
query_dispatcher: Arc<dyn QueryDispatcher>,
|
||||||
quadtree: QBVH<ColliderHandle>,
|
qbvh: QBVH<ColliderHandle>,
|
||||||
tree_built: bool,
|
tree_built: bool,
|
||||||
dilation_factor: Real,
|
dilation_factor: Real,
|
||||||
}
|
}
|
||||||
@@ -98,8 +98,8 @@ where
|
|||||||
self.map_typed_part_at(shape_id, f);
|
self.map_typed_part_at(shape_id, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn typed_quadtree(&self) -> &QBVH<ColliderHandle> {
|
fn typed_qbvh(&self) -> &QBVH<ColliderHandle> {
|
||||||
&self.query_pipeline.quadtree
|
&self.query_pipeline.qbvh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ impl QueryPipeline {
|
|||||||
{
|
{
|
||||||
Self {
|
Self {
|
||||||
query_dispatcher: Arc::new(d),
|
query_dispatcher: Arc::new(d),
|
||||||
quadtree: QBVH::new(),
|
qbvh: QBVH::new(),
|
||||||
tree_built: false,
|
tree_built: false,
|
||||||
dilation_factor: 0.01,
|
dilation_factor: 0.01,
|
||||||
}
|
}
|
||||||
@@ -285,8 +285,7 @@ impl QueryPipeline {
|
|||||||
colliders,
|
colliders,
|
||||||
mode,
|
mode,
|
||||||
};
|
};
|
||||||
self.quadtree
|
self.qbvh.clear_and_rebuild(generator, self.dilation_factor);
|
||||||
.clear_and_rebuild(generator, self.dilation_factor);
|
|
||||||
|
|
||||||
// FIXME: uncomment this once we handle insertion/removals properly.
|
// FIXME: uncomment this once we handle insertion/removals properly.
|
||||||
// self.tree_built = true;
|
// self.tree_built = true;
|
||||||
@@ -296,13 +295,13 @@ impl QueryPipeline {
|
|||||||
for handle in islands.iter_active_bodies() {
|
for handle in islands.iter_active_bodies() {
|
||||||
let body_colliders: &RigidBodyColliders = bodies.index(handle.0);
|
let body_colliders: &RigidBodyColliders = bodies.index(handle.0);
|
||||||
for handle in &body_colliders.0 {
|
for handle in &body_colliders.0 {
|
||||||
self.quadtree.pre_update(*handle)
|
self.qbvh.pre_update(*handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match mode {
|
match mode {
|
||||||
QueryPipelineMode::CurrentPosition => {
|
QueryPipelineMode::CurrentPosition => {
|
||||||
self.quadtree.update(
|
self.qbvh.update(
|
||||||
|handle| {
|
|handle| {
|
||||||
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
||||||
colliders.index_bundle(handle.0);
|
colliders.index_bundle(handle.0);
|
||||||
@@ -312,7 +311,7 @@ impl QueryPipeline {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
QueryPipelineMode::SweepTestWithNextPosition => {
|
QueryPipelineMode::SweepTestWithNextPosition => {
|
||||||
self.quadtree.update(
|
self.qbvh.update(
|
||||||
|handle| {
|
|handle| {
|
||||||
let co_parent: Option<&ColliderParent> = colliders.get(handle.0);
|
let co_parent: Option<&ColliderParent> = colliders.get(handle.0);
|
||||||
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
||||||
@@ -330,7 +329,7 @@ impl QueryPipeline {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
QueryPipelineMode::SweepTestWithPredictedPosition { dt } => {
|
QueryPipelineMode::SweepTestWithPredictedPosition { dt } => {
|
||||||
self.quadtree.update(
|
self.qbvh.update(
|
||||||
|handle| {
|
|handle| {
|
||||||
let co_parent: Option<&ColliderParent> = colliders.get(handle.0);
|
let co_parent: Option<&ColliderParent> = colliders.get(handle.0);
|
||||||
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
let (co_pos, co_shape): (&ColliderPosition, &ColliderShape) =
|
||||||
@@ -392,7 +391,7 @@ impl QueryPipeline {
|
|||||||
let mut visitor =
|
let mut visitor =
|
||||||
RayCompositeShapeToiBestFirstVisitor::new(&pipeline_shape, ray, max_toi, solid);
|
RayCompositeShapeToiBestFirstVisitor::new(&pipeline_shape, ray, max_toi, solid);
|
||||||
|
|
||||||
self.quadtree.traverse_best_first(&mut visitor).map(|h| h.1)
|
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the closest intersection between a ray and a set of collider.
|
/// Find the closest intersection between a ray and a set of collider.
|
||||||
@@ -432,7 +431,7 @@ impl QueryPipeline {
|
|||||||
solid,
|
solid,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.quadtree.traverse_best_first(&mut visitor).map(|h| h.1)
|
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the all intersections between a ray and a set of collider and passes them to a callback.
|
/// Find the all intersections between a ray and a set of collider and passes them to a callback.
|
||||||
@@ -486,7 +485,7 @@ impl QueryPipeline {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut visitor = RayIntersectionsVisitor::new(ray, max_toi, &mut leaf_callback);
|
let mut visitor = RayIntersectionsVisitor::new(ray, max_toi, &mut leaf_callback);
|
||||||
self.quadtree.traverse_depth_first(&mut visitor);
|
self.qbvh.traverse_depth_first(&mut visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the handle of up to one collider intersecting the given shape.
|
/// Gets the handle of up to one collider intersecting the given shape.
|
||||||
@@ -521,7 +520,7 @@ impl QueryPipeline {
|
|||||||
shape,
|
shape,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.quadtree
|
self.qbvh
|
||||||
.traverse_best_first(&mut visitor)
|
.traverse_best_first(&mut visitor)
|
||||||
.map(|h| (h.1 .0))
|
.map(|h| (h.1 .0))
|
||||||
}
|
}
|
||||||
@@ -558,7 +557,7 @@ impl QueryPipeline {
|
|||||||
let mut visitor =
|
let mut visitor =
|
||||||
PointCompositeShapeProjBestFirstVisitor::new(&pipeline_shape, point, solid);
|
PointCompositeShapeProjBestFirstVisitor::new(&pipeline_shape, point, solid);
|
||||||
|
|
||||||
self.quadtree
|
self.qbvh
|
||||||
.traverse_best_first(&mut visitor)
|
.traverse_best_first(&mut visitor)
|
||||||
.map(|h| (h.1 .1, h.1 .0))
|
.map(|h| (h.1 .1, h.1 .0))
|
||||||
}
|
}
|
||||||
@@ -607,7 +606,7 @@ impl QueryPipeline {
|
|||||||
|
|
||||||
let mut visitor = PointIntersectionsVisitor::new(point, &mut leaf_callback);
|
let mut visitor = PointIntersectionsVisitor::new(point, &mut leaf_callback);
|
||||||
|
|
||||||
self.quadtree.traverse_depth_first(&mut visitor);
|
self.qbvh.traverse_depth_first(&mut visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the projection of a point on the closest collider.
|
/// Find the projection of a point on the closest collider.
|
||||||
@@ -642,7 +641,7 @@ impl QueryPipeline {
|
|||||||
let pipeline_shape = self.as_composite_shape(colliders, query_groups, filter);
|
let pipeline_shape = self.as_composite_shape(colliders, query_groups, filter);
|
||||||
let mut visitor =
|
let mut visitor =
|
||||||
PointCompositeShapeProjWithFeatureBestFirstVisitor::new(&pipeline_shape, point, false);
|
PointCompositeShapeProjWithFeatureBestFirstVisitor::new(&pipeline_shape, point, false);
|
||||||
self.quadtree
|
self.qbvh
|
||||||
.traverse_best_first(&mut visitor)
|
.traverse_best_first(&mut visitor)
|
||||||
.map(|h| (h.1 .1 .0, h.1 .0, h.1 .1 .1))
|
.map(|h| (h.1 .1 .0, h.1 .0, h.1 .1 .1))
|
||||||
}
|
}
|
||||||
@@ -654,7 +653,7 @@ impl QueryPipeline {
|
|||||||
mut callback: impl FnMut(&ColliderHandle) -> bool,
|
mut callback: impl FnMut(&ColliderHandle) -> bool,
|
||||||
) {
|
) {
|
||||||
let mut visitor = BoundingVolumeIntersectionsVisitor::new(aabb, &mut callback);
|
let mut visitor = BoundingVolumeIntersectionsVisitor::new(aabb, &mut callback);
|
||||||
self.quadtree.traverse_depth_first(&mut visitor);
|
self.qbvh.traverse_depth_first(&mut visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Casts a shape at a constant linear velocity and retrieve the first collider it hits.
|
/// Casts a shape at a constant linear velocity and retrieve the first collider it hits.
|
||||||
@@ -698,7 +697,7 @@ impl QueryPipeline {
|
|||||||
shape,
|
shape,
|
||||||
max_toi,
|
max_toi,
|
||||||
);
|
);
|
||||||
self.quadtree.traverse_best_first(&mut visitor).map(|h| h.1)
|
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Casts a shape with an arbitrary continuous motion and retrieve the first collider it hits.
|
/// Casts a shape with an arbitrary continuous motion and retrieve the first collider it hits.
|
||||||
@@ -749,7 +748,7 @@ impl QueryPipeline {
|
|||||||
end_time,
|
end_time,
|
||||||
stop_at_penetration,
|
stop_at_penetration,
|
||||||
);
|
);
|
||||||
self.quadtree.traverse_best_first(&mut visitor).map(|h| h.1)
|
self.qbvh.traverse_best_first(&mut visitor).map(|h| h.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieve all the colliders intersecting the given shape.
|
/// Retrieve all the colliders intersecting the given shape.
|
||||||
@@ -805,6 +804,6 @@ impl QueryPipeline {
|
|||||||
let shape_aabb = shape.compute_aabb(shape_pos);
|
let shape_aabb = shape.compute_aabb(shape_pos);
|
||||||
let mut visitor = BoundingVolumeIntersectionsVisitor::new(&shape_aabb, &mut leaf_callback);
|
let mut visitor = BoundingVolumeIntersectionsVisitor::new(&shape_aabb, &mut leaf_callback);
|
||||||
|
|
||||||
self.quadtree.traverse_depth_first(&mut visitor);
|
self.qbvh.traverse_depth_first(&mut visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user