Skip to content

Commit 66e7ff5

Browse files
committed
work in progress update to bevy 0.16
1 parent c1af22b commit 66e7ff5

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_mujoco"
3-
version = "0.15.0"
3+
version = "0.16.0"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
resolver = "2"
@@ -9,9 +9,9 @@ keywords = ["mujoco", "bevy", "physics", "robotics"]
99
repository = "https://github.com/stillonearth/bevy_mujoco"
1010

1111
[dependencies]
12-
mujoco-rust = { git="https://github.com/stillonearth/MuJoCo-Rust.git", rev="27d4500" }
12+
mujoco-rust = { git = "https://github.com/stillonearth/MuJoCo-Rust.git", rev = "27d4500" }
1313
arrayvec = "0.7.2"
14-
bevy = "0.15"
14+
bevy = "0.16"
1515
trees = "0.4.1"
1616
serde = { version = "1", features = ["derive"] }
1717
itertools = "0.13"

src/lib.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,20 @@ fn setup_mujoco(
183183

184184
// This is a closure that can call itself recursively
185185
struct SpawnEntities<'s> {
186-
f: &'s dyn Fn(&SpawnEntities, BodyTree, &mut ChildBuilder, usize),
186+
f: &'s dyn Fn(&SpawnEntities, BodyTree, &mut ChildSpawnerCommands, usize),
187187
}
188188

189189
impl SpawnEntities<'_> {
190190
/// Spawn a bevy entity for MuJoCo body
191191
#[allow(clippy::too_many_arguments)]
192192
fn spawn_body(
193193
&self,
194-
child_builder: &mut ChildBuilder,
194+
child_builder: &mut ChildSpawnerCommands,
195195
body: &Body,
196196
geoms: &[Geom],
197197
meshes: &Rc<RefCell<ResMut<Assets<Mesh>>>>,
198198
materials: &Rc<RefCell<ResMut<Assets<StandardMaterial>>>>,
199-
add_children: impl FnOnce(&mut ChildBuilder),
199+
add_children: impl FnOnce(&mut ChildSpawnerCommands),
200200
depth: usize,
201201
) {
202202
let geom = body.render_geom(geoms);
@@ -225,19 +225,16 @@ fn setup_mujoco(
225225
root_body: depth == 0,
226226
},
227227
Name::new(format!("MuJoCo::body_{}", body.name)),
228-
SpatialBundle {
229-
transform: body_transform,
230-
..default()
231-
},
228+
Visibility::default(),
229+
body_transform.clone(),
232230
));
233231

234232
binding.with_children(|children| {
235-
let mut cmd = children.spawn(PbrBundle {
236-
mesh: Mesh3d(meshes.add(mesh)),
237-
material: MeshMaterial3d(materials.add(geom_material(geom))),
238-
transform: geom_transform,
239-
..default()
240-
});
233+
let mut cmd = children.spawn((
234+
Mesh3d(meshes.add(mesh)),
235+
MeshMaterial3d(materials.add(geom_material(geom))),
236+
geom_transform,
237+
));
241238

242239
cmd.insert(Name::new(format!("MuJoCo::mesh_{}", body.name)));
243240
if geom.geom_type == GeomType::MESH {
@@ -260,7 +257,7 @@ fn setup_mujoco(
260257
f: &|func, body, child_builder, depth| {
261258
let root_leaf = body.data();
262259

263-
let add_children = |child_builder: &mut ChildBuilder| {
260+
let add_children = |child_builder: &mut ChildSpawnerCommands| {
264261
let mut body = body.clone();
265262
loop {
266263
let leaf = body.pop_back();
@@ -287,7 +284,11 @@ fn setup_mujoco(
287284
let body_tree = body_tree(&bodies);
288285
// each mujoco body is defined as a tree
289286
commands
290-
.spawn((Name::new("MuJoCo::world"), SpatialBundle::default()))
287+
.spawn((
288+
Name::new("MuJoCo::world"),
289+
Transform::default(),
290+
Visibility::default(),
291+
))
291292
.with_children(|child_builder| {
292293
for body in body_tree {
293294
(spawn_entities.f)(&spawn_entities, body, child_builder, 0);

0 commit comments

Comments
 (0)