restore jupiter, add "physics off" command
This commit is contained in:
parent
de8eb23d91
commit
19de229bb2
|
@ -10,6 +10,7 @@ actor 0 0 0 suit
|
||||||
|
|
||||||
actor 300000 0 500000 jupiter
|
actor 300000 0 500000 jupiter
|
||||||
scale 200000
|
scale 200000
|
||||||
|
physics off
|
||||||
rotationy -1.40
|
rotationy -1.40
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0.0001 0
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,7 @@ struct ParserState {
|
||||||
is_alive: bool,
|
is_alive: bool,
|
||||||
is_suited: bool,
|
is_suited: bool,
|
||||||
is_vehicle: bool,
|
is_vehicle: bool,
|
||||||
|
has_physics: bool,
|
||||||
thrust_forward: f32,
|
thrust_forward: f32,
|
||||||
thrust_sideways: f32,
|
thrust_sideways: f32,
|
||||||
thrust_back: f32,
|
thrust_back: f32,
|
||||||
|
@ -254,6 +255,7 @@ impl Default for ParserState {
|
||||||
is_alive: false,
|
is_alive: false,
|
||||||
is_suited: false,
|
is_suited: false,
|
||||||
is_vehicle: false,
|
is_vehicle: false,
|
||||||
|
has_physics: true,
|
||||||
thrust_forward: default_engine.thrust_forward,
|
thrust_forward: default_engine.thrust_forward,
|
||||||
thrust_sideways: default_engine.thrust_forward,
|
thrust_sideways: default_engine.thrust_forward,
|
||||||
thrust_back: default_engine.thrust_back,
|
thrust_back: default_engine.thrust_back,
|
||||||
|
@ -339,10 +341,12 @@ impl ParserState {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Physics Parameters
|
// Physics Parameters
|
||||||
|
if self.has_physics {
|
||||||
let fix_scale = 1.0 / self.model_scale.powf(3.0);
|
let fix_scale = 1.0 / self.model_scale.powf(3.0);
|
||||||
actor.insert(RigidBody::Dynamic);
|
actor.insert(RigidBody::Dynamic);
|
||||||
actor.insert(self.collider.clone());
|
actor.insert(self.collider.clone());
|
||||||
actor.insert(ColliderDensity(self.mass * fix_scale));
|
actor.insert(ColliderDensity(self.mass * fix_scale));
|
||||||
|
}
|
||||||
|
|
||||||
// Optional Components
|
// Optional Components
|
||||||
if self.is_player {
|
if self.is_player {
|
||||||
|
@ -555,6 +559,9 @@ pub fn load_defs(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
["physics", "off"] => {
|
||||||
|
state.has_physics = false;
|
||||||
|
}
|
||||||
["collider", "sphere", radius] => {
|
["collider", "sphere", radius] => {
|
||||||
if let Ok(radius_float) = radius.parse::<f32>() {
|
if let Ok(radius_float) = radius.parse::<f32>() {
|
||||||
state.collider = Collider::sphere(radius_float);
|
state.collider = Collider::sphere(radius_float);
|
||||||
|
|
Loading…
Reference in a new issue