add "mesh handcrafted" command
This commit is contained in:
parent
23a85807a5
commit
2402fe7b03
|
@ -53,6 +53,7 @@ struct ParserState {
|
||||||
wants_maxrotation: Option<f64>,
|
wants_maxrotation: Option<f64>,
|
||||||
wants_maxvelocity: Option<f64>,
|
wants_maxvelocity: Option<f64>,
|
||||||
collider_is_mesh: bool,
|
collider_is_mesh: bool,
|
||||||
|
collider_is_one_mesh_of_scene: bool,
|
||||||
thrust_forward: f32,
|
thrust_forward: f32,
|
||||||
thrust_sideways: f32,
|
thrust_sideways: f32,
|
||||||
thrust_back: f32,
|
thrust_back: f32,
|
||||||
|
@ -96,6 +97,7 @@ impl Default for ParserState {
|
||||||
wants_maxrotation: None,
|
wants_maxrotation: None,
|
||||||
wants_maxvelocity: None,
|
wants_maxvelocity: None,
|
||||||
collider_is_mesh: false,
|
collider_is_mesh: false,
|
||||||
|
collider_is_one_mesh_of_scene: false,
|
||||||
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,
|
||||||
|
@ -362,6 +364,9 @@ pub fn load_defs(
|
||||||
["collider", "mesh"] => {
|
["collider", "mesh"] => {
|
||||||
state.collider_is_mesh = true;
|
state.collider_is_mesh = true;
|
||||||
}
|
}
|
||||||
|
["collider", "handcrafted"] => {
|
||||||
|
state.collider_is_one_mesh_of_scene = true;
|
||||||
|
}
|
||||||
["player", "yes"] => {
|
["player", "yes"] => {
|
||||||
state.is_player = true;
|
state.is_player = true;
|
||||||
state.is_alive = true;
|
state.is_alive = true;
|
||||||
|
@ -482,17 +487,21 @@ fn spawn_entities(
|
||||||
actor.insert(AngularVelocity(state.angular_momentum));
|
actor.insert(AngularVelocity(state.angular_momentum));
|
||||||
actor.insert(ColliderDensity(state.density));
|
actor.insert(ColliderDensity(state.density));
|
||||||
if state.collider_is_mesh {
|
if state.collider_is_mesh {
|
||||||
|
actor.insert(MassPropertiesBundle::new_computed(
|
||||||
|
&Collider::sphere(0.5 * state.model_scale as f64), state.density));
|
||||||
|
actor.insert(AsyncSceneCollider::new(Some(
|
||||||
|
ComputedCollider::TriMesh
|
||||||
|
//ComputedCollider::ConvexDecomposition(VHACDParameters::default())
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
else if state.collider_is_one_mesh_of_scene {
|
||||||
|
actor.insert(MassPropertiesBundle::new_computed(
|
||||||
|
&Collider::sphere(0.5 * state.model_scale as f64), state.density));
|
||||||
actor.insert(AsyncSceneCollider::new(None)
|
actor.insert(AsyncSceneCollider::new(None)
|
||||||
.with_shape_for_name("Collider", ComputedCollider::TriMesh)
|
.with_shape_for_name("Collider", ComputedCollider::TriMesh)
|
||||||
.with_layers_for_name("Collider", CollisionLayers::ALL)
|
.with_layers_for_name("Collider", CollisionLayers::ALL)
|
||||||
//.with_density_for_name("Collider", state.density)
|
//.with_density_for_name("Collider", state.density)
|
||||||
);
|
);
|
||||||
actor.insert(MassPropertiesBundle::new_computed(
|
|
||||||
&Collider::sphere(0.5 * state.model_scale as f64), state.density));
|
|
||||||
//actor.insert(AsyncSceneCollider::new(Some(
|
|
||||||
//ComputedCollider::TriMesh
|
|
||||||
//ComputedCollider::ConvexDecomposition(VHACDParameters::default())
|
|
||||||
//)));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
actor.insert(state.collider.clone());
|
actor.insert(state.collider.clone());
|
||||||
|
|
Loading…
Reference in a new issue