Some other bullshit
This commit is contained in:
@@ -49,7 +49,6 @@ pub fn apply_animation(
|
||||
>,
|
||||
) {
|
||||
for (mut trf, facing_direction, frame) in children {
|
||||
// Melee model scale is in decimeters
|
||||
trf.rotation = Quat::IDENTITY;
|
||||
if let AnimKind::Turn = frame.kind {
|
||||
trf.rotate_local_y(
|
||||
|
||||
+18
-2
@@ -149,14 +149,16 @@ pub fn fighter_debug(
|
||||
|
||||
pub fn animation_debug(query: Query<(&GlobalTransform, &FighterBoneMatrices)>, mut gizmos: Gizmos) {
|
||||
for (global_transform, matrices) in query {
|
||||
let (_, rotation, translation) = global_transform.to_scale_rotation_translation();
|
||||
let marker_transform = Transform::from_translation(translation).with_rotation(rotation);
|
||||
for (_, matrix) in matrices.iter() {
|
||||
let pos = global_transform.transform_point(Vec3::new(
|
||||
let pos = marker_transform.transform_point(Vec3::new(
|
||||
matrix.cols[3][0].to_num(),
|
||||
matrix.cols[3][1].to_num(),
|
||||
matrix.cols[3][2].to_num(),
|
||||
));
|
||||
gizmos.cross(pos, 0.5, bevy::color::palettes::css::RED);
|
||||
gizmos.axes(*global_transform, 1.0);
|
||||
gizmos.axes(marker_transform, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,6 +292,20 @@ fn capsule_wireframe() -> &'static CapsuleWireframe {
|
||||
mod capsule_debug_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn animation_markers_ignore_visual_scale() {
|
||||
let global = GlobalTransform::from(Transform {
|
||||
translation: Vec3::new(3.0, 4.0, 5.0),
|
||||
rotation: Quat::from_rotation_y(std::f32::consts::FRAC_PI_2),
|
||||
scale: Vec3::splat(10.0),
|
||||
});
|
||||
let (_, rotation, translation) = global.to_scale_rotation_translation();
|
||||
let marker_transform = Transform::from_translation(translation).with_rotation(rotation);
|
||||
|
||||
let marker = marker_transform.transform_point(Vec3::new(2.0, 0.0, 0.0));
|
||||
assert!(marker.abs_diff_eq(Vec3::new(3.0, 4.0, 3.0), 1e-5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capsule_wireframe_caps_extend_in_opposite_directions() {
|
||||
let wireframe = capsule_wireframe();
|
||||
|
||||
+18
-6
@@ -1,9 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use bevy::{
|
||||
asset::UntypedHandle,
|
||||
prelude::*,
|
||||
};
|
||||
use bevy::{asset::UntypedHandle, prelude::*};
|
||||
use bevy_asset_loader::asset_collection::AssetCollection;
|
||||
use ron_asset_manager::prelude::RonAsset;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -11,10 +8,16 @@ use strum::IntoEnumIterator;
|
||||
use strum_macros::EnumIter;
|
||||
|
||||
use crate::{
|
||||
AppState, fighter::{FighterAttributes, FighterCameraProfile, animation::AnimKind, attack::AttackKind}, game_settings::GameSettings, math::{int::FGi32, vec3::FGVec3}, texture_reference::TextureReference,
|
||||
AppState,
|
||||
fighter::{FighterAttributes, FighterCameraProfile, animation::AnimKind, attack::AttackKind},
|
||||
game_settings::GameSettings,
|
||||
math::{int::FGi32, vec3::FGVec3},
|
||||
texture_reference::TextureReference,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Reflect, EnumIter, Default)]
|
||||
#[derive(
|
||||
Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Reflect, EnumIter, Default,
|
||||
)]
|
||||
pub enum FighterId {
|
||||
#[default]
|
||||
TestFighter,
|
||||
@@ -35,6 +38,8 @@ pub struct FighterHurtbox {
|
||||
pub struct FighterManifest {
|
||||
pub id: FighterId,
|
||||
pub model_path: String,
|
||||
#[reflect(ignore)]
|
||||
pub model_scale: FGi32,
|
||||
pub baked_animation_path: String,
|
||||
#[asset]
|
||||
#[dependency]
|
||||
@@ -108,6 +113,13 @@ pub fn prepare_fighter_manifests(
|
||||
);
|
||||
return;
|
||||
}
|
||||
if manifest.model_scale <= FGi32::ZERO {
|
||||
fail(
|
||||
&mut next_state,
|
||||
&format!("{:?} has a non-positive model scale", manifest.id),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if manifest.baked_animation_path.is_empty() {
|
||||
fail(
|
||||
&mut next_state,
|
||||
|
||||
Reference in New Issue
Block a user