Add ECB bone markers
This commit is contained in:
+13
-2
@@ -171,21 +171,32 @@ pub fn animation_debug(
|
||||
&FighterTranslation,
|
||||
&FighterFacingDirection,
|
||||
&FighterBoneMatrices,
|
||||
&Fighter,
|
||||
)>,
|
||||
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 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(
|
||||
matrix.cols[3][0].to_num(),
|
||||
matrix.cols[3][1].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.axes(marker_transform, 1.0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user