Just some tweaks.
This commit is contained in:
parent
97c9b637ef
commit
f26226dcb7
1 changed files with 13 additions and 9 deletions
22
src/bike.rs
22
src/bike.rs
|
@ -23,7 +23,7 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
|
|
||||||
let mut bbody = RigidBodyBundle::default();
|
let mut bbody = RigidBodyBundle::default();
|
||||||
|
|
||||||
bbody.damping.angular_damping = 0.8;
|
bbody.damping.angular_damping = 0.5;
|
||||||
bbody.damping.linear_damping = 0.1;
|
bbody.damping.linear_damping = 0.1;
|
||||||
bbody.activation = RigidBodyActivation::cannot_sleep().into();
|
bbody.activation = RigidBodyActivation::cannot_sleep().into();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
);
|
);
|
||||||
let bcollide = ColliderBundle {
|
let bcollide = ColliderBundle {
|
||||||
shape: shape.into(),
|
shape: shape.into(),
|
||||||
mass_properties: ColliderMassProps::Density(0.82).into(),
|
mass_properties: ColliderMassProps::Density(0.2).into(),
|
||||||
flags: ColliderFlags {
|
flags: ColliderFlags {
|
||||||
collision_groups: BIKE_BODY_GROUP,
|
collision_groups: BIKE_BODY_GROUP,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -81,12 +81,16 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
.id();
|
.id();
|
||||||
|
|
||||||
// seriously the cyberbike is so fucking huge what the heck
|
// seriously the cyberbike is so fucking huge what the heck
|
||||||
let wheel_positions = vec![-5.1, 4.7, 4.7, -5.1];
|
let wheel_positions = vec![-5.1, 4.7, -5.1];
|
||||||
let wheel_rad = 1.55;
|
let wheel_y = -1.8f32;
|
||||||
let wheel_y = -1.5f32;
|
|
||||||
|
|
||||||
for (i, &wheel_z) in wheel_positions.iter().enumerate() {
|
for (i, &wheel_z) in wheel_positions.iter().enumerate() {
|
||||||
let wheel_x = if i % 2 == 0 { -2.5 } else { 2.5 };
|
let (wheel_x, wheel_rad, stiffness) = match i {
|
||||||
|
0 => (-2.6, 0.95, 0.014),
|
||||||
|
2 => (2.6, 0.95, 0.014),
|
||||||
|
1 => (0.0, 1.2, 0.019),
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
let offset = Vec3::new(wheel_x, wheel_y, wheel_z);
|
let offset = Vec3::new(wheel_x, wheel_y, wheel_z);
|
||||||
let trans = xform.translation + offset;
|
let trans = xform.translation + offset;
|
||||||
let wheel_pos_in_world = Isometry::from_parts(trans.into(), xform.rotation.into());
|
let wheel_pos_in_world = Isometry::from_parts(trans.into(), xform.rotation.into());
|
||||||
|
@ -102,7 +106,7 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
ccd: RigidBodyCcd {
|
ccd: RigidBodyCcd {
|
||||||
ccd_enabled: true,
|
ccd_enabled: true,
|
||||||
ccd_max_dist: wheel_rad,
|
ccd_max_dist: wheel_rad,
|
||||||
ccd_thickness: 0.1,
|
ccd_thickness: 0.01,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
|
@ -123,11 +127,11 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
.insert(ColliderDebugRender::from(Color::YELLOW))
|
.insert(ColliderDebugRender::from(Color::YELLOW))
|
||||||
.id();
|
.id();
|
||||||
|
|
||||||
let (stiffness, damping) = (0.011, 0.25);
|
let damping = 0.25;
|
||||||
|
|
||||||
let prismatic = PrismaticJoint::new(Vector::y_axis())
|
let prismatic = PrismaticJoint::new(Vector::y_axis())
|
||||||
.local_anchor1(offset.into())
|
.local_anchor1(offset.into())
|
||||||
.motor_position(-0.2, stiffness, damping);
|
.motor_position(-0.4, stiffness, damping);
|
||||||
|
|
||||||
commands.spawn_bundle(((JointBuilderComponent::new(prismatic, bike, _wheel_rb)),));
|
commands.spawn_bundle(((JointBuilderComponent::new(prismatic, bike, _wheel_rb)),));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue