Good bird_large mount offsets

This commit is contained in:
Joshua Barretto 2023-05-16 21:10:53 +01:00
parent cfdf184c4c
commit 3238863c26
3 changed files with 30 additions and 9 deletions

View File

@ -64,6 +64,7 @@ pub fn is_mountable(mount: &Body, rider: Option<&Body>) -> bool {
match mount {
Body::Humanoid(_) => matches!(rider, Some(Body::BirdMedium(_))),
Body::BipedLarge(_) => is_light_enough(rider),
Body::BirdLarge(_) => is_light_enough(rider),
Body::QuadrupedMedium(body) => match body.species {
quadruped_medium::Species::Alpaca
| quadruped_medium::Species::Antelope

View File

@ -274,9 +274,8 @@ impl Body {
pub fn jump_impulse(&self) -> Option<f32> {
match self {
Body::Object(_) | Body::Ship(_) | Body::ItemDrop(_) => None,
Body::BipedLarge(_) | Body::Dragon(_) | Body::Golem(_) | Body::QuadrupedLow(_) => {
Some(0.4 * self.mass().0)
},
Body::BipedLarge(_) | Body::Dragon(_) => Some(0.6 * self.mass().0),
Body::Golem(_) | Body::QuadrupedLow(_) => Some(0.4 * self.mass().0),
Body::QuadrupedMedium(_) => Some(0.4 * self.mass().0),
Body::Theropod(body) => match body.species {
theropod::Species::Snowraptor

View File

@ -96,16 +96,22 @@ impl Skeleton for BirdLargeSkeleton {
make_bone(foot_l_mat),
make_bone(foot_r_mat),
];
// Offset from the mounted bone's origin.
let mount_position = (neck_mat * Vec4::from_point(mount_point(&body)))
.homogenized()
.xyz();
// NOTE: We apply the ori from base_mat externally so we don't need to worry
// about it here for now.
let mount_orientation = self.neck.orientation;
Offsets {
lantern: None,
viewpoint: Some((head_mat * Vec4::new(0.0, 3.0, 6.0, 1.0)).xyz()),
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: comp::Body::BirdLarge(body)
.mount_offset()
.into_tuple()
.into(),
..Default::default()
position: mount_position,
orientation: mount_orientation,
scale: Vec3::one(),
},
primary_trail_mat: None,
secondary_trail_mat: None,
@ -307,3 +313,18 @@ impl<'a> From<&'a Body> for SkeletonAttr {
}
}
}
fn mount_point(body: &Body) -> Vec3<f32> {
use comp::bird_large::Species::*;
match (body.species, body.body_type) {
(Phoenix, _) => (0.0, -2.0, 6.0),
(Cockatrice, _) => (0.0, 0.0, 6.0),
(Roc, _) => (0.0, 6.0, 3.0),
(FlameWyvern, _) => (0.0, 0.0, 2.5),
(FrostWyvern, _) => (0.0, 2.0, 3.0),
(CloudWyvern, _) => (0.0, 1.0, 3.0),
(SeaWyvern, _) => (0.0, -3.0, 4.0),
(WealdWyvern, _) => (0.0, 0.0, 5.0),
}
.into()
}