Compare commits
No commits in common. "2358d53b7a060a323c25882ff1b61ac15586973d" and "9d82ddbf0956555fd21dbcb0f1b6bb6523c90a9a" have entirely different histories.
2358d53b7a
...
9d82ddbf09
3 changed files with 19 additions and 16 deletions
30
src/bike.rs
30
src/bike.rs
|
@ -157,31 +157,28 @@ fn wheels_helper(
|
|||
};
|
||||
|
||||
let xform = Transform::from_translation(position);
|
||||
let hub_mesh: Mesh = Sphere::new(0.1).into();
|
||||
|
||||
let hub = commands
|
||||
.spawn((
|
||||
Name::new("hub"),
|
||||
SpatialBundle::from_transform(xform),
|
||||
RigidBody::Dynamic,
|
||||
MassPropertiesBundle::new_computed(&Collider::sphere(0.1), 200.0),
|
||||
PbrBundle {
|
||||
mesh: meshes.add(hub_mesh),
|
||||
material: materials.add(wheel_material.clone()),
|
||||
transform: xform,
|
||||
..Default::default()
|
||||
},
|
||||
))
|
||||
.with_children(|parent| {
|
||||
let mesh: Mesh = Sphere::new(0.1).into();
|
||||
parent.spawn(PbrBundle {
|
||||
mesh: meshes.add(mesh),
|
||||
material: materials.add(wheel_material.clone()),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.id();
|
||||
|
||||
let tire = commands
|
||||
.spawn((
|
||||
Name::new("tire"),
|
||||
PbrBundle {
|
||||
mesh: meshes.add(tire_mesh),
|
||||
material: materials.add(wheel_material.clone()),
|
||||
transform: xform,
|
||||
..Default::default()
|
||||
},
|
||||
SpatialBundle::from_transform(xform),
|
||||
CyberWheel,
|
||||
RigidBody::Dynamic,
|
||||
collider,
|
||||
|
@ -193,6 +190,13 @@ fn wheels_helper(
|
|||
CollisionMargin(0.05),
|
||||
SweptCcd::NON_LINEAR,
|
||||
))
|
||||
.with_children(|p| {
|
||||
p.spawn(PbrBundle {
|
||||
mesh: meshes.add(tire_mesh),
|
||||
material: materials.add(wheel_material.clone()),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.id();
|
||||
|
||||
// connect hubs and tires to make wheels
|
||||
|
|
|
@ -43,7 +43,6 @@ fn ground_and_light(
|
|||
) {
|
||||
commands
|
||||
.spawn((
|
||||
SpatialBundle::default(),
|
||||
RigidBody::Static,
|
||||
Collider::cuboid(50.0, 0.5, 50.0),
|
||||
CollisionMargin(0.1),
|
||||
|
@ -54,7 +53,7 @@ fn ground_and_light(
|
|||
p.spawn(PbrBundle {
|
||||
mesh: meshes.add(Plane3d::default().mesh().size(50.0, 50.0)),
|
||||
material: materials.add(Color::from(SILVER)),
|
||||
transform: Transform::from_xyz(0.0, 0.4, 0.0),
|
||||
transform: Transform::from_xyz(0.0, 1.0, 0.0),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ pub struct CatControllerSettings {
|
|||
impl Default for CatControllerSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
kp: 1200.0,
|
||||
kp: 950.0,
|
||||
kd: 10.0,
|
||||
ki: 50.0,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue