mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
animation orientation fix, first jump
Former-commit-id: e4653bbdc553e496edfe011bf5aa2f97a4cf3b90
This commit is contained in:
parent
6da495f0bd
commit
ac78d322d6
BIN
assets/voxygen/voxel/belt.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/belt.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/chest.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/chest.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/foot.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/foot.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/head.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/head.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/pants.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/pants.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/sword.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/sword.vox
(Stored with Git LFS)
Binary file not shown.
@ -24,60 +24,60 @@ impl Animation for IdleAnimation {
|
||||
let waveultracos_slow = (anim_time as f32 * 1.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
|
||||
next.head.offset = Vec3::new(5.5, 0.0, 12.0 + waveultra_slow * 0.4);
|
||||
next.head.ori = Quaternion::rotation_y(waveultra_slow * 0.05);
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 11.5 + waveultra_slow * 0.4);
|
||||
next.head.ori = Quaternion::rotation_x(waveultra_slow * 0.05);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(2.5, 0.0, 8.0 + waveultra_slow * 0.4);
|
||||
next.chest.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 7.5 + waveultra_slow * 0.4);
|
||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(2.5, 0.0, 6.0 + waveultra_slow * 0.4);
|
||||
next.belt.ori = Quaternion::rotation_y(0.0);
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 5.5 + waveultra_slow * 0.4);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(2.5, 0.0, 3.0 + waveultra_slow * 0.4);
|
||||
next.shorts.ori = Quaternion::rotation_y(0.0);
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 2.5 + waveultra_slow * 0.4);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
2.0 + waveultracos_slow * 0.3,
|
||||
7.5,
|
||||
12.5 + waveultra_slow * 1.1,
|
||||
-7.5, -2.0 + waveultracos_slow * 0.3,
|
||||
|
||||
12.0 + waveultra_slow * 1.1,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + waveultra_slow * 0.06);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
2.0 + waveultracos_slow * 0.3,
|
||||
-7.5,
|
||||
12.5 + waveultra_slow * 1.1,
|
||||
7.5, -2.0 + waveultracos_slow * 0.3,
|
||||
|
||||
12.0 + waveultra_slow * 1.1,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + waveultra_slow * 0.06);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(5.0, 3.4, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_y(0.04 + waveultra_slow * 0.04);
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.04 - waveultra_slow * 0.04);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(5.0, -3.4, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_y(0.04 + waveultra_slow * 0.04);
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.04 - waveultra_slow * 0.04);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-4.5, 14.0, 13.0);
|
||||
next.weapon.ori = Quaternion::rotation_x(2.5);
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 18.5);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_y(0.0);
|
||||
next.torso.offset = Vec3::new(-0.5, 0.0, 0.1);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(2.9, 6.0, 18.0);
|
||||
next.l_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_shoulder.scale = Vec3::one();
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(2.9, -6.0, 18.0);
|
||||
next.r_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one();
|
||||
|
||||
next
|
||||
|
80
voxygen/src/anim/character/jump.rs
Normal file
80
voxygen/src/anim/character/jump.rs
Normal file
@ -0,0 +1,80 @@
|
||||
// Standard
|
||||
use std::f32::consts::PI;
|
||||
|
||||
// Library
|
||||
use vek::*;
|
||||
|
||||
// Local
|
||||
use super::{super::Animation, CharacterSkeleton, SCALE};
|
||||
//
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = CharacterSkeleton;
|
||||
type Dependency = f64;
|
||||
|
||||
fn update_skeleton(skeleton: &Self::Skeleton, global_time: f64, anim_time: f64) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let arcwave = (1.0f32.ln_1p() - 1.0).abs();
|
||||
let wavetest = (wave.cbrt());
|
||||
let fuzzwave = (anim_time as f32 * 12.0).sin();
|
||||
let wavecos = (anim_time as f32 * 14.0).cos();
|
||||
let wave_slow = (anim_time as f32 * 5.0 + PI).sin();
|
||||
let wave_slowtest = (anim_time as f32).min(PI/2.0).sin();
|
||||
let wavecos_slow = (anim_time as f32 * 8.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
let mult = wave_slow / (wave_slow.abs());
|
||||
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 12.0);
|
||||
next.head.ori = Quaternion::rotation_x(0.15);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 8.0);
|
||||
next.chest.ori = Quaternion::rotation_z(0.0);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 6.0);
|
||||
next.belt.ori = Quaternion::rotation_z(0.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 3.0);
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(-7.5, -2.0, 12.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.8);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(7.5, -2.0, 12.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(-0.8);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(wave_slow * -1.2);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(wave_slow * 1.2);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, 0.0, 0.2);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(3.0, 6.0, 18.0);
|
||||
next.l_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.l_shoulder.scale = Vec3::one();
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(3.0, -6.0, 18.0);
|
||||
next.r_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.r_shoulder.scale = Vec3::one();
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
pub mod idle;
|
||||
pub mod run;
|
||||
pub mod jump;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
pub use self::jump::JumpAnimation;
|
||||
// Crate
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
|
@ -24,44 +24,44 @@ impl Animation for RunAnimation {
|
||||
let wavecos_slow = (anim_time as f32 * 8.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
|
||||
next.head.offset = Vec3::new(6.0, 0.0, 12.0 + wavecos * 1.3);
|
||||
next.head.ori = Quaternion::rotation_y(-0.15);
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 12.0 + wavecos * 1.3);
|
||||
next.head.ori = Quaternion::rotation_x(0.15);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(2.5, 0.0, 8.0 + wavecos * 1.1);
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 8.0 + wavecos * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(wave * 0.1);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(2.5, 0.0, 6.0 + wavecos * 1.1);
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 6.0 + wavecos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.25);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(2.5, 0.0, 3.0 + wavecos * 1.1);
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 3.0 + wavecos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(2.0 - wavecos * 2.5, 7.5, 12.0 + wave * 1.5);
|
||||
next.l_hand.ori = Quaternion::rotation_y(wavecos * 0.9);
|
||||
next.l_hand.offset = Vec3::new(-7.5, -2.0 + wavecos * 2.5, 12.0 - wave * 1.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(wavecos * 0.9);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(2.0 + wavecos * 2.5, -7.5, 12.0 - wave * 1.5);
|
||||
next.r_hand.ori = Quaternion::rotation_y(wavecos * -0.9);
|
||||
next.r_hand.offset = Vec3::new(7.5, -2.0 - wavecos * 2.5, 12.0 + wave * 1.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(wavecos * -0.9);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(3.5 + wave * 1.0, 3.4, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_y(-0.0 - wave * 1.5);
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave * 1.5);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.5 - wave * 1.0, -3.4, 6.0);
|
||||
next.r_foot.ori = Quaternion::rotation_y(-0.0 + wave * 1.5);
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave * 1.0, 6.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, 14.0, 13.0);
|
||||
next.weapon.ori = Quaternion::rotation_x(2.5);
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_y(0.25 + wavecos * 0.1);
|
||||
next.torso.offset = Vec3::new(-0.5, 0.0, 0.2);
|
||||
next.torso.ori = Quaternion::rotation_x(-0.25 - wavecos * 0.1);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(3.0, 6.0, 18.0);
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
anim::{
|
||||
character::{CharacterSkeleton, IdleAnimation, RunAnimation},
|
||||
character::{CharacterSkeleton, IdleAnimation, RunAnimation, JumpAnimation},
|
||||
Animation, Skeleton,
|
||||
},
|
||||
mesh::Meshable,
|
||||
@ -110,7 +110,7 @@ impl FigureCache {
|
||||
match head {
|
||||
Head::DefaultHead => "head.vox",
|
||||
},
|
||||
Vec3::new(-7.5, -8.0, 0.0),
|
||||
Vec3::new(-7.0, -5.5, -6.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ impl FigureCache {
|
||||
match chest {
|
||||
Chest::DefaultChest => "chest.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -6.0, 0.0),
|
||||
Vec3::new(-6.0, -3.5, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ impl FigureCache {
|
||||
match belt {
|
||||
Belt::DefaultBelt => "belt.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -5.0, 0.0),
|
||||
Vec3::new(-5.0, -3.5, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ impl FigureCache {
|
||||
match pants {
|
||||
Pants::DefaultPants => "pants.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -5.0, 0.0),
|
||||
Vec3::new(-5.0, -3.5, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ impl FigureCache {
|
||||
match hand {
|
||||
Hand::DefaultHand => "hand.vox",
|
||||
},
|
||||
Vec3::new(0.0, -2.0, -7.0),
|
||||
Vec3::new(3.5, 0.0, -7.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ impl FigureCache {
|
||||
match hand {
|
||||
Hand::DefaultHand => "hand.vox",
|
||||
},
|
||||
Vec3::new(0.0, -2.0, -7.0),
|
||||
Vec3::new(3.5, 0.0, -7.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ impl FigureCache {
|
||||
match foot {
|
||||
Foot::DefaultFoot => "foot.vox",
|
||||
},
|
||||
Vec3::new(-3.5, -2.5, -8.0),
|
||||
Vec3::new(2.5, -3.5, -9.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ impl FigureCache {
|
||||
match foot {
|
||||
Foot::DefaultFoot => "foot.vox",
|
||||
},
|
||||
Vec3::new(-3.5, -2.5, -8.0),
|
||||
Vec3::new(2.5, -3.5, -9.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -213,10 +213,10 @@ impl FigureCache {
|
||||
RunAnimation::update_skeleton(&mut state.skeleton, time, animation_history.time)
|
||||
},
|
||||
comp::character::Animation::Jump => {
|
||||
JumpAnimation::update_skeleton(&mut state.skeleton, time, animation_history.time)
|
||||
},
|
||||
// TODO
|
||||
// JumpAnimation::update_skeleton(&mut state.skeleton, time)
|
||||
state.skeleton.clone()
|
||||
},
|
||||
};
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
@ -267,7 +267,7 @@ impl<S: Skeleton> FigureState<S> {
|
||||
fn update(&mut self, renderer: &mut Renderer, pos: Vec3<f32>, dir: Vec3<f32>) {
|
||||
let mat = Mat4::<f32>::identity()
|
||||
* Mat4::translation_3d(pos)
|
||||
* Mat4::rotation_z(-dir.x.atan2(dir.y) + f32::consts::PI / 2.0);
|
||||
* Mat4::rotation_z(-dir.x.atan2(dir.y));// + f32::consts::PI / 2.0);
|
||||
|
||||
let locals = FigureLocals::new(mat);
|
||||
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
||||
|
@ -26,7 +26,7 @@ impl Singleplayer {
|
||||
pub fn new() -> (Self, SocketAddr) {
|
||||
let (sender, reciever) = channel();
|
||||
|
||||
let sock = SocketAddr::from(([0; 4], pick_unused_port()
|
||||
let sock = SocketAddr::from(([127,0,0,1], pick_unused_port()
|
||||
.expect("Failed to find unused port")));
|
||||
|
||||
let sock2 = sock.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user