load plane mode
reset orientation if no plane head
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::{
|
||||
GameState,
|
||||
head::ActiveHead,
|
||||
heads_database::{HeadControls, HeadsDatabase},
|
||||
player::PlayerBodyMesh,
|
||||
};
|
||||
|
||||
mod collisions;
|
||||
@@ -74,6 +75,7 @@ fn head_change(
|
||||
query: Query<&ActiveHead, Changed<ActiveHead>>,
|
||||
heads_db: Res<HeadsDatabase>,
|
||||
mut selected_controller: ResMut<SelectedController>,
|
||||
mut rig_transform_q: Option<Single<&mut Transform, With<PlayerBodyMesh>>>,
|
||||
) {
|
||||
for head in query.iter() {
|
||||
let stats = heads_db.head_stats(head.0);
|
||||
@@ -83,6 +85,12 @@ fn head_change(
|
||||
};
|
||||
|
||||
if selected_controller.0 != controller {
|
||||
if controller == ControllerSet::ApplyControlsRun {
|
||||
if let Some(mut transform) = rig_transform_q.take() {
|
||||
transform.rotation = Quat::IDENTITY;
|
||||
}
|
||||
}
|
||||
|
||||
selected_controller.0 = controller;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user