@@ 44,7 44,7 @@ fn main() {
fn spawn_planets(mut commands: Commands) {
info!("Spawning planets");
let earth_pos = Transform::from_xyz(0.0, 0.0, 0.0);
- let earth_radius = 100.0;
+ let earth_radius = 2000.0 / SCALE;
commands
.spawn(PlanetBundle {
planet_type: PlanetType::Earth,
@@ 80,7 80,7 @@ fn on_message(
let mut rng = rand::thread_rng();
rng.gen::<f32>() * std::f32::consts::PI * 2.
};
- let mut transform = Transform::from_xyz(angle.cos() * 210., angle.sin() * 210., 0.0);
+ let mut transform = Transform::from_xyz(angle.cos() * 2050. / SCALE, angle.sin() * 2050. / SCALE, 0.0);
transform.rotate_z(angle);
let id = commands
.spawn(PlayerBundle {
@@ 90,18 90,19 @@ fn on_message(
},
player: Player { addr: *addr, username: username.to_string() },
})
- .insert(Collider::cuboid(10.0, 10.0))
+ .insert(Collider::cuboid(25.0 / SCALE, 25.0 / SCALE))
.insert(RigidBody::Dynamic)
.id().index();
// tell this player the planets
let mut planets = Vec::new();
for (entity, planet_type, transform) in planet_query.iter() {
+ let translation = transform.translation;
planets.push((entity.index(), Planet {
planet_type: *planet_type,
- transform: proto_transform!(transform),
+ transform: proto_transform!(Transform::from_translation(translation * SCALE)),
radius: match *planet_type {
- PlanetType::Earth => 100.0
+ PlanetType::Earth => 2000.0
}
}));
}
@@ 133,12 134,12 @@ fn on_message(
for (entity, part_type, transform) in &part_query {
parts.push((entity.index(), Part {
part_type: *part_type,
- transform: proto_transform!(transform),
+ transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
}));
}
parts.push((id, Part {
part_type: PartType::Hearty,
- transform: proto_transform!(transform),
+ transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
}));
let packet = Packet::PartPositions {
parts
@@ 197,7 198,7 @@ fn on_position_change(
let id = commands.entity(entity).id().index();
updated_parts.push((id, Part {
part_type: *part_type,
- transform: proto_transform!(transform),
+ transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
}));
}
@@ 213,9 214,9 @@ fn on_position_change(
let id = commands.entity(entity).id().index();
planets.push((id, Planet {
planet_type: *planet_type,
- transform: proto_transform!(transform),
+ transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
radius: match *planet_type {
- PlanetType::Earth => 100.0,
+ PlanetType::Earth => 2000.0,
}
}));
}