done with it for now, bringing back into cyber rider
This commit is contained in:
parent
66a05ea8ef
commit
2358d53b7a
2 changed files with 14 additions and 17 deletions
28
src/bike.rs
28
src/bike.rs
|
@ -157,28 +157,31 @@ fn wheels_helper(
|
||||||
};
|
};
|
||||||
|
|
||||||
let xform = Transform::from_translation(position);
|
let xform = Transform::from_translation(position);
|
||||||
|
let hub_mesh: Mesh = Sphere::new(0.1).into();
|
||||||
|
|
||||||
let hub = commands
|
let hub = commands
|
||||||
.spawn((
|
.spawn((
|
||||||
Name::new("hub"),
|
Name::new("hub"),
|
||||||
SpatialBundle::from_transform(xform),
|
|
||||||
RigidBody::Dynamic,
|
RigidBody::Dynamic,
|
||||||
MassPropertiesBundle::new_computed(&Collider::sphere(0.1), 200.0),
|
MassPropertiesBundle::new_computed(&Collider::sphere(0.1), 200.0),
|
||||||
))
|
PbrBundle {
|
||||||
.with_children(|parent| {
|
mesh: meshes.add(hub_mesh),
|
||||||
let mesh: Mesh = Sphere::new(0.1).into();
|
|
||||||
parent.spawn(PbrBundle {
|
|
||||||
mesh: meshes.add(mesh),
|
|
||||||
material: materials.add(wheel_material.clone()),
|
material: materials.add(wheel_material.clone()),
|
||||||
|
transform: xform,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
},
|
||||||
})
|
))
|
||||||
.id();
|
.id();
|
||||||
|
|
||||||
let tire = commands
|
let tire = commands
|
||||||
.spawn((
|
.spawn((
|
||||||
Name::new("tire"),
|
Name::new("tire"),
|
||||||
SpatialBundle::from_transform(xform),
|
PbrBundle {
|
||||||
|
mesh: meshes.add(tire_mesh),
|
||||||
|
material: materials.add(wheel_material.clone()),
|
||||||
|
transform: xform,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
CyberWheel,
|
CyberWheel,
|
||||||
RigidBody::Dynamic,
|
RigidBody::Dynamic,
|
||||||
collider,
|
collider,
|
||||||
|
@ -190,13 +193,6 @@ fn wheels_helper(
|
||||||
CollisionMargin(0.05),
|
CollisionMargin(0.05),
|
||||||
SweptCcd::NON_LINEAR,
|
SweptCcd::NON_LINEAR,
|
||||||
))
|
))
|
||||||
.with_children(|p| {
|
|
||||||
p.spawn(PbrBundle {
|
|
||||||
mesh: meshes.add(tire_mesh),
|
|
||||||
material: materials.add(wheel_material.clone()),
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.id();
|
.id();
|
||||||
|
|
||||||
// connect hubs and tires to make wheels
|
// connect hubs and tires to make wheels
|
||||||
|
|
|
@ -43,6 +43,7 @@ fn ground_and_light(
|
||||||
) {
|
) {
|
||||||
commands
|
commands
|
||||||
.spawn((
|
.spawn((
|
||||||
|
SpatialBundle::default(),
|
||||||
RigidBody::Static,
|
RigidBody::Static,
|
||||||
Collider::cuboid(50.0, 0.5, 50.0),
|
Collider::cuboid(50.0, 0.5, 50.0),
|
||||||
CollisionMargin(0.1),
|
CollisionMargin(0.1),
|
||||||
|
@ -53,7 +54,7 @@ fn ground_and_light(
|
||||||
p.spawn(PbrBundle {
|
p.spawn(PbrBundle {
|
||||||
mesh: meshes.add(Plane3d::default().mesh().size(50.0, 50.0)),
|
mesh: meshes.add(Plane3d::default().mesh().size(50.0, 50.0)),
|
||||||
material: materials.add(Color::from(SILVER)),
|
material: materials.add(Color::from(SILVER)),
|
||||||
transform: Transform::from_xyz(0.0, 1.0, 0.0),
|
transform: Transform::from_xyz(0.0, 0.4, 0.0),
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue