UE4 - Creating a RPG #22 -Smashing Bugs

노기현·2024년 11월 28일

Today's Lesson: Smashing Bugs

Summary

1. We show you how to fix a few bugs within our project, starting with making your sword only hit the enemy once.

2. We also go over how to smooth the character movement.

Virtus Learning Hub


✅ Sword Attack시 데미지 처리가 2번 되는 버그

◼️ Bool Type 변수를 이용해 한 번만 처리
In Character Blueprint <SimpleAI>

  • New Variable: CanBeHitWithMelee
    Type: Boolean
    Default Value: True
  • Branch
    CanBeHitWithMelee == True ?
    True인 경우면 실행
  • SimpleAi의 남은 health가 0보다 큰 경우
    → CanBeHitWithMelee False
    → Delay를 통해 일정 시간 후
    → CanBeHitWithMelee True

✅ Loot Bag Pick up 로직 추가

◼️ 기존 Magic Character 전용 로직 활용

  • Box Component → On Component Begin Overlap
    → Cast to Sword Character
    ...

✅ 부자연스러운 애니메이션 보완

◼️ Animation State 수정
In Animation Blueprint <Sword_AnimBP>

  • State Machine - Idle State 추가
  • Idle State
    Final Animation Pose 결정
    sword_and_shield_idle
  • Transition Rule
    - Idle → Movement: Speed > 10
    - Movement → Idle: Speed <= 10
    - Idle → Sword_Attack: SlashSword == True
    - Sword_Attack → SlashSword == False

◼️ 보간 시간 수정
In Blend Space <Walk_Run_BS>

  • Horizontal/Vertical Axis - Interpolation Time: 1.0

✅ Result

  • 조금 더 자연스러운 Animation 재생
profile
RPG 기획자 지망생

0개의 댓글