add axialtilt command
This commit is contained in:
parent
3463fb3c4c
commit
21fc2a55f5
|
@ -56,6 +56,7 @@ struct ParserState {
|
||||||
model: Option<String>,
|
model: Option<String>,
|
||||||
model_scale: f32,
|
model_scale: f32,
|
||||||
rotation: Quat,
|
rotation: Quat,
|
||||||
|
axialtilt: f32,
|
||||||
velocity: DVec3,
|
velocity: DVec3,
|
||||||
angular_momentum: DVec3,
|
angular_momentum: DVec3,
|
||||||
pronoun: Option<String>,
|
pronoun: Option<String>,
|
||||||
|
@ -111,6 +112,7 @@ impl Default for ParserState {
|
||||||
model: None,
|
model: None,
|
||||||
model_scale: 1.0,
|
model_scale: 1.0,
|
||||||
rotation: Quat::IDENTITY,
|
rotation: Quat::IDENTITY,
|
||||||
|
axialtilt: 0.0,
|
||||||
velocity: DVec3::splat(0.0),
|
velocity: DVec3::splat(0.0),
|
||||||
angular_momentum: DVec3::new(0.03, 0.3, 0.09),
|
angular_momentum: DVec3::new(0.03, 0.3, 0.09),
|
||||||
pronoun: None,
|
pronoun: None,
|
||||||
|
@ -357,6 +359,16 @@ pub fn load_defs(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
["axialtilt", rotation_y] => {
|
||||||
|
if let Ok(rotation_y_float) = rotation_y.parse::<f32>() {
|
||||||
|
state.rotation *= Quat::from_rotation_y(rotation_y_float.to_radians());
|
||||||
|
state.axialtilt = rotation_y_float;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error!("Can't parse float: {line}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
["velocity", x, y, z] => {
|
["velocity", x, y, z] => {
|
||||||
if let (Ok(x_float), Ok(y_float), Ok(z_float)) =
|
if let (Ok(x_float), Ok(y_float), Ok(z_float)) =
|
||||||
(x.parse::<f64>(), y.parse::<f64>(), z.parse::<f64>()) {
|
(x.parse::<f64>(), y.parse::<f64>(), z.parse::<f64>()) {
|
||||||
|
@ -524,6 +536,7 @@ fn spawn_entities(
|
||||||
) {
|
) {
|
||||||
for state_wrapper in er_spawn.read() {
|
for state_wrapper in er_spawn.read() {
|
||||||
let state = &state_wrapper.0;
|
let state = &state_wrapper.0;
|
||||||
|
let mut rotation = state.rotation;
|
||||||
if state.class == DefClass::Actor {
|
if state.class == DefClass::Actor {
|
||||||
// Preprocessing
|
// Preprocessing
|
||||||
let mut absolute_pos = if let Some(id) = &state.relative_to {
|
let mut absolute_pos = if let Some(id) = &state.relative_to {
|
||||||
|
@ -586,13 +599,13 @@ fn spawn_entities(
|
||||||
actor.insert(world::DespawnOnPlayerDeath);
|
actor.insert(world::DespawnOnPlayerDeath);
|
||||||
actor.insert(actor::HitPoints::default());
|
actor.insert(actor::HitPoints::default());
|
||||||
actor.insert(Position::from(absolute_pos));
|
actor.insert(Position::from(absolute_pos));
|
||||||
actor.insert(Rotation::from(state.rotation));
|
|
||||||
if state.is_sphere {
|
if state.is_sphere {
|
||||||
let sphere_texture_handle = if let Some(model) = &state.model {
|
let sphere_texture_handle = if let Some(model) = &state.model {
|
||||||
Some(asset_server.load(format!("textures/{}.jpg", model)))
|
Some(asset_server.load(format!("textures/{}.jpg", model)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
rotation = Quat::from_rotation_x(-90f32.to_radians()) * rotation;
|
||||||
let sphere_handle = meshes.add(Sphere::new(1.0).mesh().uv(128, 128));
|
let sphere_handle = meshes.add(Sphere::new(1.0).mesh().uv(128, 128));
|
||||||
let sphere_material_handle = materials.add(StandardMaterial {
|
let sphere_material_handle = materials.add(StandardMaterial {
|
||||||
base_color_texture: sphere_texture_handle,
|
base_color_texture: sphere_texture_handle,
|
||||||
|
@ -613,6 +626,7 @@ fn spawn_entities(
|
||||||
});
|
});
|
||||||
load::load(model.as_str(), &mut actor, &*asset_server);
|
load::load(model.as_str(), &mut actor, &*asset_server);
|
||||||
}
|
}
|
||||||
|
actor.insert(Rotation::from(rotation));
|
||||||
|
|
||||||
// Physics Parameters
|
// Physics Parameters
|
||||||
if state.has_physics {
|
if state.has_physics {
|
||||||
|
@ -827,8 +841,7 @@ fn spawn_entities(
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
Position::new(absolute_pos),
|
Position::new(absolute_pos),
|
||||||
Rotation::from(Quat::IDENTITY),
|
Rotation::from(Quat::from_rotation_z(-state.axialtilt.to_radians())),
|
||||||
//Rotation::from(Quat::from_rotation_x(-0.3f32.to_radians())),
|
|
||||||
NotShadowCaster,
|
NotShadowCaster,
|
||||||
NotShadowReceiver,
|
NotShadowReceiver,
|
||||||
));
|
));
|
||||||
|
|
|
@ -11,8 +11,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 2439.7e3
|
scale 2439.7e3
|
||||||
rotationx -90
|
axialtilt 0.034
|
||||||
rotationy 0.034
|
|
||||||
orbitaround sol 57.91e9
|
orbitaround sol 57.91e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 57.91e9
|
scale 57.91e9
|
||||||
|
@ -26,8 +25,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 6115e3
|
scale 6115e3
|
||||||
rotationx -90
|
axialtilt 177.36
|
||||||
rotationy 177.36
|
|
||||||
orbitaround sol 108.21e9
|
orbitaround sol 108.21e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 108.21e9
|
scale 108.21e9
|
||||||
|
@ -41,8 +39,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 6371e3
|
scale 6371e3
|
||||||
rotationx -90
|
axialtilt 23.4392811
|
||||||
rotationy 23.4392811
|
|
||||||
orbitaround sol 149.598023e9
|
orbitaround sol 149.598023e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 149.598023e9
|
scale 149.598023e9
|
||||||
|
@ -56,8 +53,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 3389.5e3
|
scale 3389.5e3
|
||||||
rotationx -90
|
axialtilt 25.19
|
||||||
rotationy 25.19
|
|
||||||
orbitaround sol 227.939366e9
|
orbitaround sol 227.939366e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 227.939366e9
|
scale 227.939366e9
|
||||||
|
@ -75,7 +71,6 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
ring yes
|
ring yes
|
||||||
physics off
|
physics off
|
||||||
rotationx -90
|
|
||||||
rotationy 3.13
|
rotationy 3.13
|
||||||
rotationz 135
|
rotationz 135
|
||||||
angularmomentum 30 30 30
|
angularmomentum 30 30 30
|
||||||
|
@ -146,7 +141,6 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 421700e3
|
orbitaround jupiter 421700e3
|
||||||
scale 1822e3
|
scale 1822e3
|
||||||
rotationx -90
|
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0.0001 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
|
@ -163,7 +157,6 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 670900e3
|
orbitaround jupiter 670900e3
|
||||||
scale 1561e3
|
scale 1561e3
|
||||||
rotationx -90
|
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0.0001 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
|
@ -180,7 +173,6 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 1070400e3
|
orbitaround jupiter 1070400e3
|
||||||
scale 2634e3
|
scale 2634e3
|
||||||
rotationx -90
|
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0.0001 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
|
@ -197,7 +189,6 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 1882700e3
|
orbitaround jupiter 1882700e3
|
||||||
scale 2410e3
|
scale 2410e3
|
||||||
rotationx -90
|
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0.0001 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
|
@ -214,8 +205,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 58232e3
|
scale 58232e3
|
||||||
rotationx -90
|
axialtilt 26.73
|
||||||
rotationy 26.73
|
|
||||||
orbitaround sol 1433.53e9
|
orbitaround sol 1433.53e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 1433.53e9
|
scale 1433.53e9
|
||||||
|
@ -229,8 +219,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 25362e3
|
scale 25362e3
|
||||||
rotationx -90
|
axialtilt 82.23
|
||||||
rotationy 82.23
|
|
||||||
orbitaround sol 2870.972e9
|
orbitaround sol 2870.972e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 2870.972e9
|
scale 2870.972e9
|
||||||
|
@ -244,8 +233,7 @@ actor 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
physics off
|
physics off
|
||||||
scale 24622e3
|
scale 24622e3
|
||||||
rotationx -90
|
axialtilt 28.32
|
||||||
rotationy 28.32
|
|
||||||
orbitaround sol 4500e9
|
orbitaround sol 4500e9
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
scale 4500e9
|
scale 4500e9
|
||||||
|
|
Loading…
Reference in a new issue