WIP crisper camera controls (fix rotation/accleration with vehicles)
This commit is contained in:
parent
2e35f90a19
commit
3a7ab8c9ac
|
@ -588,6 +588,7 @@ pub fn handle_vehicle_enter_exit(
|
||||||
commands.entity(driver).remove::<PlayerCamera>();
|
commands.entity(driver).remove::<PlayerCamera>();
|
||||||
commands.entity(driver).remove::<WantsRotationChange>();
|
commands.entity(driver).remove::<WantsRotationChange>();
|
||||||
commands.entity(driver).remove::<Collider>();
|
commands.entity(driver).remove::<Collider>();
|
||||||
|
commands.entity(driver).remove::<WantsAcceleration>();
|
||||||
commands.entity(driver).insert(JustNowEnteredVehicle);
|
commands.entity(driver).insert(JustNowEnteredVehicle);
|
||||||
commands
|
commands
|
||||||
.entity(vehicle)
|
.entity(vehicle)
|
||||||
|
@ -595,6 +596,7 @@ pub fn handle_vehicle_enter_exit(
|
||||||
commands.entity(vehicle).remove::<hud::IsTargeted>();
|
commands.entity(vehicle).remove::<hud::IsTargeted>();
|
||||||
commands.entity(vehicle).insert(PlayerCamera);
|
commands.entity(vehicle).insert(PlayerCamera);
|
||||||
commands.entity(vehicle).insert(PlayerDrivesThis);
|
commands.entity(vehicle).insert(PlayerDrivesThis);
|
||||||
|
commands.entity(vehicle).insert(WantsMaxRotation(0.0));
|
||||||
if let Ok(mut flashlight_trans) = q_playerflashlight.get_single_mut() {
|
if let Ok(mut flashlight_trans) = q_playerflashlight.get_single_mut() {
|
||||||
flashlight_trans.rotation = Quat::from_rotation_y(0f32);
|
flashlight_trans.rotation = Quat::from_rotation_y(0f32);
|
||||||
flashlight_trans.translation = Vec3::new(0.0, 0.0, 0.0);
|
flashlight_trans.translation = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
@ -614,11 +616,15 @@ pub fn handle_vehicle_enter_exit(
|
||||||
Quat::from_rotation_y(180f32.to_radians());
|
Quat::from_rotation_y(180f32.to_radians());
|
||||||
flashlight_trans.translation = Vec3::new(0.0, 0.0, 1.0);
|
flashlight_trans.translation = Vec3::new(0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
commands.entity(driver).insert(WantsAcceleration::default());
|
||||||
commands.entity(driver).insert(RigidBody::Dynamic);
|
commands.entity(driver).insert(RigidBody::Dynamic);
|
||||||
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::ExitVehicle));
|
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::ExitVehicle));
|
||||||
|
commands.entity(vehicle).remove::<WantsMaxRotation>();
|
||||||
commands.entity(vehicle).remove::<PlayerCamera>();
|
commands.entity(vehicle).remove::<PlayerCamera>();
|
||||||
commands.entity(driver).insert(PlayerCamera);
|
commands.entity(driver).insert(PlayerCamera);
|
||||||
commands.entity(vehicle).remove::<PlayerDrivesThis>();
|
commands.entity(vehicle).remove::<PlayerDrivesThis>();
|
||||||
|
commands.entity(vehicle).remove::<WantsAcceleration>();
|
||||||
|
commands.entity(vehicle).remove::<WantsRotationChange>();
|
||||||
*vehicle_vis = Visibility::Visible;
|
*vehicle_vis = Visibility::Visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue