Make orientation not dependend on camera dir while wielded

This commit is contained in:
timokoesters 2020-03-19 22:03:17 +01:00
parent 1e1ce2adbf
commit 208245e82e
3 changed files with 7 additions and 8 deletions

View File

@ -55,7 +55,10 @@ impl CharacterState {
match self {
CharacterState::Wielding
| CharacterState::BasicMelee(_)
| CharacterState::BasicRanged(_)
| CharacterState::DashMelee(_)
| CharacterState::TimedCombo(_)
| CharacterState::ChargeAttack(_)
| CharacterState::BasicBlock => true,
_ => false,
}
@ -66,6 +69,7 @@ impl CharacterState {
CharacterState::BasicMelee(_)
| CharacterState::BasicRanged(_)
| CharacterState::TimedCombo(_)
| CharacterState::DashMelee(_)
| CharacterState::ChargeAttack(_) => true,
_ => false,
}

View File

@ -35,6 +35,7 @@ impl CharacterBehavior for Data {
if self.initialize {
update.vel.0 = data.inputs.look_dir * 20.0;
update.ori.0 = update.vel.0;
}
if self.buildup_duration != Duration::default() && data.physics.touch_entity.is_none() {

View File

@ -54,10 +54,7 @@ fn basic_move(data: &JoinData, update: &mut StateUpdate) {
}
// Set direction based on move direction
let ori_dir = if update.character.is_wield()
|| update.character.is_attack()
|| update.character.is_block()
{
let ori_dir = if update.character.is_attack() || update.character.is_block() {
Vec2::from(data.inputs.look_dir).normalized()
} else {
Vec2::from(data.inputs.move_dir)
@ -84,10 +81,7 @@ fn swim_move(data: &JoinData, update: &mut StateUpdate) {
};
// Set direction based on move direction when on the ground
let ori_dir = if update.character.is_wield()
|| update.character.is_attack()
|| update.character.is_block()
{
let ori_dir = if update.character.is_attack() || update.character.is_block() {
Vec2::from(data.inputs.look_dir).normalized()
} else {
Vec2::from(update.vel.0)