checkpoint adding lean mod to cat system
This commit is contained in:
parent
3fc0a3e45c
commit
5378aef653
1 changed files with 8 additions and 3 deletions
|
@ -2,7 +2,9 @@ use std::f32::consts::PI;
|
|||
#[cfg(feature = "inspector")]
|
||||
use std::time::Instant;
|
||||
|
||||
use bevy::prelude::{Commands, Entity, Query, Res, ResMut, Time, Transform, Vec3, With, Without};
|
||||
use bevy::prelude::{
|
||||
Commands, Entity, Quat, Query, Res, ResMut, Time, Transform, Vec3, With, Without,
|
||||
};
|
||||
use bevy_rapier3d::prelude::{
|
||||
CollisionGroups, ExternalForce, Group, MultibodyJoint, QueryFilter, RapierConfiguration,
|
||||
RapierContext, ReadMassProperties, Velocity,
|
||||
|
@ -10,7 +12,7 @@ use bevy_rapier3d::prelude::{
|
|||
|
||||
#[cfg(feature = "inspector")]
|
||||
use super::ActionDebugInstant;
|
||||
use super::{CatControllerSettings, CatControllerState, MovementSettings, Tunneling};
|
||||
use super::{CatControllerSettings, CatControllerState, CyberLean, MovementSettings, Tunneling};
|
||||
use crate::{
|
||||
bike::{CyberBikeBody, CyberSteering, CyberWheel, BIKE_WHEEL_COLLISION_GROUP},
|
||||
input::InputState,
|
||||
|
@ -35,10 +37,13 @@ pub(super) fn falling_cat(
|
|||
mut bike_query: Query<(&Transform, &mut ExternalForce, &mut CatControllerState)>,
|
||||
time: Res<Time>,
|
||||
settings: Res<CatControllerSettings>,
|
||||
lean: Res<CyberLean>,
|
||||
#[cfg(feature = "inspector")] mut debug_instant: ResMut<ActionDebugInstant>,
|
||||
) {
|
||||
let (xform, mut forces, mut control_vars) = bike_query.single_mut();
|
||||
let wup = xform.translation.normalize();
|
||||
let mut wup = Transform::from_translation(xform.translation);
|
||||
wup.rotate(Quat::from_axis_angle(xform.back(), lean.lean));
|
||||
let wup = wup.up();
|
||||
let bike_up = xform.up();
|
||||
|
||||
let wright = xform.forward().cross(wup).normalize();
|
||||
|
|
Loading…
Reference in a new issue