tweak legs

This commit is contained in:
yuni 2024-04-22 23:25:32 +02:00
parent 228380b9f4
commit 191d918e4f

View file

@ -45,6 +45,9 @@ pub fn asset_name_to_path(name: &str) -> &'static str {
}
pub fn skeleton_name_to_skeletondef(name: &str) -> Option<SkeletonDef> {
// x: positive: left, negative: right
// y: positive: upward, negative: downward
// z: positive: forward, negative: backward
match name {
"suitv1" => Some(SkeletonDef::Human(HumanDef {
collider: "skeleton/suit_v1/collider.glb#Scene0".into(),
@ -84,7 +87,7 @@ pub fn skeleton_name_to_skeletondef(name: &str) -> Option<SkeletonDef> {
LimbDef {
class: Limb::UpperLegLeft,
path: "skeleton/suit_v1/upper_leg.glb#Scene0".into(),
pos: Vec3::new(0.15, -0.25, 0.0),
pos: Vec3::new(0.15, -0.25, 0.1),
mirror: true,
children: vec![LimbDef {
class: Limb::LowerLegLeft,
@ -97,7 +100,7 @@ pub fn skeleton_name_to_skeletondef(name: &str) -> Option<SkeletonDef> {
LimbDef {
class: Limb::UpperLegRight,
path: "skeleton/suit_v1/upper_leg.glb#Scene0".into(),
pos: Vec3::new(-0.15, -0.25, 0.0),
pos: Vec3::new(-0.15, -0.25, 0.1),
children: vec![LimbDef {
class: Limb::LowerLegRight,
path: "skeleton/suit_v1/lower_leg.glb#Scene0".into(),
@ -299,20 +302,20 @@ pub fn animate_human_float(mut trans: &mut Transform, limb: &Limb, mirror: bool,
Limb::UpperLegRight => rot(&mut trans,
-30.0 + 10.0 * (t * 0.5).sin(),
0.0,
-25.0 + 2.5 * (t * 0.5).cos(),
-20.0 + 2.5 * (t * 0.5).cos(),
),
Limb::UpperLegLeft => rot(&mut trans,
-30.0 + 10.0 * (t * 0.5).sin(),
0.0,
25.0 - 2.5 * (t * 0.5).cos(),
20.0 - 2.5 * (t * 0.5).cos(),
),
Limb::LowerLegRight => rot(&mut trans,
30.0,
35.0 + 5.0 * (t * 0.5).sin(),
0.0,
0.0,
),
Limb::LowerLegLeft => rot(&mut trans,
30.0,
35.0 + 5.0 * (t * 0.5).sin(),
0.0,
0.0,
),