add pitch_scale for pid controller
This commit is contained in:
parent
adc6be7c7b
commit
4a80554740
2 changed files with 4 additions and 2 deletions
|
@ -85,7 +85,7 @@ impl Default for CatControllerState {
|
|||
pitch_prev: Default::default(),
|
||||
decay_factor: 0.99,
|
||||
roll_limit: 1.5,
|
||||
pitch_limit: 0.8,
|
||||
pitch_limit: 0.2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ use crate::{
|
|||
input::InputState,
|
||||
};
|
||||
|
||||
const PITCH_SCALE: f32 = 0.2;
|
||||
|
||||
/// Disable gravity in Rapier.
|
||||
pub(super) fn zero_gravity(mut config: ResMut<RapierConfiguration>) {
|
||||
config.gravity = Vec3::ZERO;
|
||||
|
@ -46,7 +48,7 @@ pub(super) fn falling_cat(
|
|||
let wright = xform.forward().cross(wup).normalize();
|
||||
|
||||
let roll_error = wright.dot(bike_up);
|
||||
let pitch_error = wup.dot(xform.back());
|
||||
let pitch_error = wup.dot(xform.back()) * PITCH_SCALE;
|
||||
|
||||
// only try to correct roll if we're not totally vertical
|
||||
if pitch_error.abs() < 0.8 {
|
||||
|
|
Loading…
Reference in a new issue