Fix one frame visual transform delay (#89)
CI / build-and-test (push) Successful in 2m28s
CI / production-build (push) Successful in 12m18s

Reviewed-on: #89
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #89.
This commit is contained in:
2026-10-12 20:21:11 +00:00
committed by EIREXE
parent 97f2fe7065
commit 0642a9234b
2 changed files with 16 additions and 4 deletions
+13 -2
View File
@@ -171,21 +171,32 @@ pub fn animation_debug(
&FighterTranslation, &FighterTranslation,
&FighterFacingDirection, &FighterFacingDirection,
&FighterBoneMatrices, &FighterBoneMatrices,
&Fighter,
)>, )>,
mut gizmos: Gizmos, mut gizmos: Gizmos,
fighter_manifests: Res<Assets<FighterManifest>>,
) { ) {
for (global_transform, facing_dir, matrices) in query { for (global_transform, facing_dir, matrices, fighter) in query {
let Some(manifest) = fighter_manifests.get(&fighter.manifest) else {
continue;
};
let global_transform = global_transform.get_3d_transform(facing_dir); let global_transform = global_transform.get_3d_transform(facing_dir);
let marker_transform = global_transform.to_mat4(); let marker_transform = global_transform.to_mat4();
for (_, matrix) in matrices.iter() { for (bone_name, matrix) in matrices.iter() {
let pos = marker_transform.transform_point(Vec3::new( let pos = marker_transform.transform_point(Vec3::new(
matrix.cols[3][0].to_num(), matrix.cols[3][0].to_num(),
matrix.cols[3][1].to_num(), matrix.cols[3][1].to_num(),
matrix.cols[3][2].to_num(), matrix.cols[3][2].to_num(),
)); ));
if manifest.ecb_bones.iter().any(|ecb_bone_name| ecb_bone_name == bone_name) {
gizmos.cross(pos, 1.0, bevy::color::palettes::css::GREEN);
} else {
gizmos.cross(pos, 0.5, bevy::color::palettes::css::RED); gizmos.cross(pos, 0.5, bevy::color::palettes::css::RED);
gizmos.axes(marker_transform, 1.0); gizmos.axes(marker_transform, 1.0);
} }
}
} }
} }
+1
View File
@@ -212,6 +212,7 @@ impl Plugin for FighterPlugin {
animation::apply_animation, animation::apply_animation,
) )
.chain() .chain()
.before(bevy::transform::TransformSystems::Propagate)
.run_if(in_state(crate::AppState::InMatch)), .run_if(in_state(crate::AppState::InMatch)),
) )
// Rollback registration lives next to the systems that write these // Rollback registration lives next to the systems that write these