Add shifting ECB based on bone positions (melee-like) #61
+15
-1
@@ -27,6 +27,7 @@ use crate::game_settings::GameSettings;
|
|||||||
use crate::input::FighterInput;
|
use crate::input::FighterInput;
|
||||||
use crate::math::int::FGi32;
|
use crate::math::int::FGi32;
|
||||||
use crate::math::vec::FGVec2;
|
use crate::math::vec::FGVec2;
|
||||||
|
use crate::math::vec3::FGVec3;
|
||||||
use crate::player::Player;
|
use crate::player::Player;
|
||||||
|
|
||||||
pub fn debug_draw_ecb(
|
pub fn debug_draw_ecb(
|
||||||
@@ -39,6 +40,12 @@ pub fn debug_draw_ecb(
|
|||||||
mut gizmos: Gizmos,
|
mut gizmos: Gizmos,
|
||||||
) {
|
) {
|
||||||
for (ecb, trf, ecb_prev, trf_prev) in ecbs {
|
for (ecb, trf, ecb_prev, trf_prev) in ecbs {
|
||||||
|
gizmos.cross(
|
||||||
|
FGVec3::new(trf.0.x, trf.0.y, FGi32::ZERO).to_vec3(),
|
||||||
|
2.0,
|
||||||
|
bevy::color::palettes::css::BLUE,
|
||||||
|
);
|
||||||
|
|
||||||
let transformed =
|
let transformed =
|
||||||
ecb.to_3d_lineloop(Transform::from_xyz(trf.x.to_num(), trf.y.to_num(), 0.0));
|
ecb.to_3d_lineloop(Transform::from_xyz(trf.x.to_num(), trf.y.to_num(), 0.0));
|
||||||
gizmos.lineloop(transformed, YELLOW);
|
gizmos.lineloop(transformed, YELLOW);
|
||||||
@@ -153,7 +160,14 @@ pub fn fighter_debug(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn animation_debug(query: Query<(&FighterTranslation, &FighterFacingDirection, &FighterBoneMatrices)>, mut gizmos: Gizmos) {
|
pub fn animation_debug(
|
||||||
|
query: Query<(
|
||||||
|
&FighterTranslation,
|
||||||
|
&FighterFacingDirection,
|
||||||
|
&FighterBoneMatrices,
|
||||||
|
)>,
|
||||||
|
mut gizmos: Gizmos,
|
||||||
|
) {
|
||||||
for (global_transform, facing_dir, matrices) in query {
|
for (global_transform, facing_dir, matrices) in query {
|
||||||
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();
|
||||||
|
|||||||
@@ -80,13 +80,10 @@ pub fn update_ecb(
|
|||||||
&FighterTranslation,
|
&FighterTranslation,
|
||||||
&FighterFacingDirection,
|
&FighterFacingDirection,
|
||||||
)>,
|
)>,
|
||||||
mut gizmos: Gizmos
|
|
||||||
) {
|
) {
|
||||||
for (mut ecb, surface_state, bone_indices, bone_matrices, translation, facing_dir) in query {
|
for (mut ecb, surface_state, bone_indices, bone_matrices, translation, facing_dir) in query {
|
||||||
let trf = translation.get_3d_transform(facing_dir);
|
let trf = translation.get_3d_transform(facing_dir);
|
||||||
|
|
||||||
gizmos.cross(trf.get_translation().to_vec3(), 2.0, bevy::color::palettes::css::BLUE);
|
|
||||||
|
|
||||||
let transformed_ecb_bones = bone_indices.indices.iter().filter_map(|idx| {
|
let transformed_ecb_bones = bone_indices.indices.iter().filter_map(|idx| {
|
||||||
let Some((_, bone_matrix)) = bone_matrices.get_by_idx(*idx) else {
|
let Some((_, bone_matrix)) = bone_matrices.get_by_idx(*idx) else {
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
Reference in New Issue
Block a user