@@ 1055,10 1055,22 @@ fn load_savefile(
.insert(RigidBody::Dynamic)
.with_children(|children| {
children
- .spawn(Collider::cuboid(18.75 / SCALE, 23.4375 / SCALE))
+ .spawn(if part_type == PartType::Cargo {
+ Collider::cuboid(18.75 / SCALE, 23.4375 / SCALE)
+ } else if part_type == PartType::Hub {
+ Collider::cuboid(PART_HALF_SIZE / SCALE, PART_HALF_SIZE / SCALE)
+ } else if part_type == PartType::LandingThruster {
+ Collider::cuboid(PART_HALF_SIZE / SCALE, 18.75 / SCALE)
+ } else { Collider::cuboid(PART_HALF_SIZE / SCALE, PART_HALF_SIZE / SCALE) })
.insert(TransformBundle::from(Transform::from_xyz(
0.,
- 1.5625 / SCALE,
+ if part_type == PartType::Cargo {
+ 1.5625 / SCALE
+ } else if part_type == PartType::Hub {
+ 0. / SCALE
+ } else if part_type == PartType::LandingThruster {
+ 6.25 / SCALE
+ } else { 0. / SCALE },
0.,
)));
})
@@ 1088,25 1100,28 @@ fn load_savefile(
.motor_position(0., 150., 10.)
.limits([0., 50. / SCALE])
.build();
- let mut suspension = commands
- .spawn(PartBundle {
- transform: TransformBundle::from(
- Transform::from_xyz(
- p_pos.x + offset.x / SCALE * angle.cos() - offset.y / SCALE * angle.sin(),
- p_pos.y + offset.x / SCALE * angle.sin() + offset.y / SCALE * angle.cos(),
- 0.,
- )
- .with_rotation(Quat::from_euler(
- EulerRot::ZYX,
- angle + angle_offset,
- 0.,
- 0.,
- )),
- ),
- part_type: PartType::LandingThrusterSuspension,
- flags: PartFlags { attached: true},
- });
- suspension.insert(RigidBody::Dynamic)
+ let mut suspension = commands.spawn(PartBundle {
+ transform: TransformBundle::from(
+ Transform::from_xyz(
+ p_pos.x + offset.x / SCALE * angle.cos()
+ - offset.y / SCALE * angle.sin(),
+ p_pos.y
+ + offset.x / SCALE * angle.sin()
+ + offset.y / SCALE * angle.cos(),
+ 0.,
+ )
+ .with_rotation(Quat::from_euler(
+ EulerRot::ZYX,
+ angle + angle_offset,
+ 0.,
+ 0.,
+ )),
+ ),
+ part_type: PartType::LandingThrusterSuspension,
+ flags: PartFlags { attached: true },
+ });
+ suspension
+ .insert(RigidBody::Dynamic)
.with_children(|children| {
children
.spawn(Collider::cuboid(PART_HALF_SIZE / SCALE, 1. / SCALE))