more computed center of mass
This commit is contained in:
parent
81bec0b2b4
commit
5596d883c5
1 changed files with 8 additions and 3 deletions
|
@ -115,14 +115,19 @@ mod systems {
|
|||
}
|
||||
|
||||
pub(super) fn apply_lean(
|
||||
mut bike_query: Query<(&Transform, &mut ExternalForce, &mut CatControllerState)>,
|
||||
mut bike_query: Query<(
|
||||
&Transform,
|
||||
&ComputedCenterOfMass,
|
||||
&mut ExternalForce,
|
||||
&mut CatControllerState,
|
||||
)>,
|
||||
wheels: Query<&WheelState>,
|
||||
time: Res<Time>,
|
||||
settings: Res<CatControllerSettings>,
|
||||
lean: Res<CyberLean>,
|
||||
mut gizmos: Gizmos,
|
||||
) -> Result {
|
||||
let (xform, mut force, mut control_vars) = bike_query.single_mut()?;
|
||||
let (xform, com, mut force, mut control_vars) = bike_query.single_mut()?;
|
||||
|
||||
let mut factor = 1.0;
|
||||
for wheel in wheels.iter() {
|
||||
|
@ -164,7 +169,7 @@ mod systems {
|
|||
force.apply_force_at_point(
|
||||
lean_force,
|
||||
xform.translation + *xform.up(),
|
||||
xform.translation,
|
||||
xform.translation + com.0,
|
||||
);
|
||||
gizmos.arrow(
|
||||
xform.translation + *xform.up(),
|
||||
|
|
Loading…
Reference in a new issue