mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
airship movement bits
This commit is contained in:
parent
983523c463
commit
31747d8ff1
@ -4,20 +4,25 @@
|
||||
//offset: (3.0, 7.0, 1.0),
|
||||
//offset: (-20.75, -34.75, 1.25),
|
||||
//offset: (0.0, 0.0, 0.0),
|
||||
offset: (-17.5, -35.0, 1.0),
|
||||
offset: (-17.5, -39.0, 1.0),
|
||||
//phys_offset: (0.25, 0.25, 0.25),
|
||||
phys_offset: (0.0, 0.0, 0.0),
|
||||
central: ("Human_Airship"),
|
||||
),
|
||||
bone1: (
|
||||
offset: (0.0, 40.0, -8.0),
|
||||
offset: (-8.5, -2.0, -8.5),
|
||||
phys_offset: (0.0, 0.0, 0.0),
|
||||
central: ("propeller-l"),
|
||||
),
|
||||
bone2: (
|
||||
offset: (0.0, 0.0, -4.0),
|
||||
offset: (-8.5, -2.0, -8.5),
|
||||
phys_offset: (0.0, 0.0, 0.0),
|
||||
central: ("propeller-r"),
|
||||
),
|
||||
bone3: (
|
||||
offset: (-1.5, -11.0, -5.5),
|
||||
phys_offset: (0.0, 0.0, 0.0),
|
||||
central: ("rudder"),
|
||||
),
|
||||
),
|
||||
})
|
||||
|
BIN
assets/server/voxel/Human_Airship.vox
(Stored with Git LFS)
BIN
assets/server/voxel/Human_Airship.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/server/voxel/propeller-l.vox
(Stored with Git LFS)
BIN
assets/server/voxel/propeller-l.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/server/voxel/propeller-r.vox
(Stored with Git LFS)
BIN
assets/server/voxel/propeller-r.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/server/voxel/rudder.vox
(Stored with Git LFS)
Normal file
BIN
assets/server/voxel/rudder.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -58,6 +58,7 @@ pub mod figuredata {
|
||||
pub bone0: ShipCentralSubSpec,
|
||||
pub bone1: ShipCentralSubSpec,
|
||||
pub bone2: ShipCentralSubSpec,
|
||||
pub bone3: ShipCentralSubSpec,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -102,7 +102,6 @@ impl Animation for RunAnimation {
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
//println!("speednorm {} ",side);
|
||||
|
||||
let head_look = Vec2::new(
|
||||
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
|
||||
|
@ -7,7 +7,14 @@ use common::comp::item::ToolKind;
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f32,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
);
|
||||
type Skeleton = ShipSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -17,17 +24,35 @@ impl Animation for IdleAnimation {
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency,
|
||||
(_active_tool_kind, _second_tool_kind, _global_time, acc_vel, orientation, last_ori): Self::Dependency,
|
||||
_anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone1.orientation = Quaternion::rotation_y(acc_vel * 0.8);
|
||||
|
||||
next.bone2.position = Vec3::new(s_a.bone2.0, s_a.bone2.1, s_a.bone2.2) / 11.0;
|
||||
next.bone2.orientation = Quaternion::rotation_y(-acc_vel * 0.8);
|
||||
|
||||
next.bone3.position = Vec3::new(s_a.bone3.0, s_a.bone3.1, s_a.bone3.2) / 11.0;
|
||||
next.bone3.orientation = Quaternion::rotation_z(tilt * 25.0);
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -12,13 +12,15 @@ pub type Body = comp::ship::Body;
|
||||
skeleton_impls!(struct ShipSkeleton {
|
||||
+ bone0,
|
||||
+ bone1,
|
||||
+ bone2,
|
||||
+ bone3,
|
||||
});
|
||||
|
||||
impl Skeleton for ShipSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
type Body = Body;
|
||||
|
||||
const BONE_COUNT: usize = 2;
|
||||
const BONE_COUNT: usize = 4;
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"ship_compute_mats\0";
|
||||
|
||||
@ -32,7 +34,9 @@ impl Skeleton for ShipSkeleton {
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
make_bone(bone0_mat * Mat4::scaling_3d(1.0 / 11.0)),
|
||||
make_bone(Mat4::<f32>::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone2) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone3) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
];
|
||||
Vec3::unit_z() * 0.5
|
||||
}
|
||||
@ -41,6 +45,8 @@ impl Skeleton for ShipSkeleton {
|
||||
pub struct SkeletonAttr {
|
||||
bone0: (f32, f32, f32),
|
||||
bone1: (f32, f32, f32),
|
||||
bone2: (f32, f32, f32),
|
||||
bone3: (f32, f32, f32),
|
||||
}
|
||||
|
||||
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
||||
@ -58,7 +64,9 @@ impl Default for SkeletonAttr {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
bone0: (0.0, 0.0, 0.0),
|
||||
bone1: (0.0, 0.0, 0.0),
|
||||
bone1: (-13.0, -25.0, 10.0),
|
||||
bone2: (13.0, -25.0, 10.0),
|
||||
bone3: (0.0, -27.5, 8.5),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4215,7 +4215,7 @@ impl BodySpec for ship::Body {
|
||||
Some(mesh_ship_bone(map, body, |spec| &spec.bone0)),
|
||||
Some(mesh_ship_bone(map, body, |spec| &spec.bone1)),
|
||||
Some(mesh_ship_bone(map, body, |spec| &spec.bone2)),
|
||||
None,
|
||||
Some(mesh_ship_bone(map, body, |spec| &spec.bone3)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -4226,14 +4226,28 @@ impl FigureMgr {
|
||||
// Standing
|
||||
(true, false, false) => anim::ship::IdleAnimation::update_skeleton(
|
||||
&ShipSkeleton::default(),
|
||||
(active_tool_kind, second_tool_kind, time),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
time,
|
||||
state.acc_vel,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
_ => anim::ship::IdleAnimation::update_skeleton(
|
||||
&ShipSkeleton::default(),
|
||||
(active_tool_kind, second_tool_kind, time),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
time,
|
||||
state.acc_vel,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
Loading…
Reference in New Issue
Block a user