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