HaywireInteractive / OnAllFronts-Public

UE5 MilSim FPS / RTS Game (formerly ProjectM)
MIT License
112 stars 22 forks source link

Fix death animation issues when LOD changes in middle of ragdoll/animation #949

Open Leroy231 opened 3 months ago

Leroy231 commented 3 months ago

Discuss with @Leroy231 before implementing.

Even though we freeze screen size LOD collector in the middle of ragdoll/death animation this is no guarantee that the LOD will be frozen. This can lead to jank if actor switches to ISM in middle of ragdoll.

Solutions:

  1. Instead of freezing closest viewer distance, freeze the LOD if an actor (will never switch from actor to ISM) with a custom LOD calculator. This could mean lots of entities will be that LOD even if they shouldn't but since they're dying/dead maybe it's OK (we should disable BP tick and anim BP tick). This would also allow us to switch back to persisting the death pose for bodies. 1a. As a separate task: But we'd need to store on the client the pose for all bodies they've ever seen because we can't store it in Mass fragment in case entity becomes irrelevant and gets destroyed. We'd need to make sure we don't use up too memory.
  2. ~Don't do ragdoll death, only montage death. Then easy to switch between actor and ISM mid-animation. But what about impulse effects e.g. from tank shell?~

[Do this in separate task] What to do for the case of zooming in on an ISM during death montage:

  1. Ideally we switch the representation from ISM to actor.
  2. We continue playing the death montage on the actor from the same time where we left off.
  3. We can still spawn the weapon at the position of the hand bone (not virtual bone because that'll be in wrong position) so that we don't have to deal with issues of virtual gun bones and montage.

When death requires impulse (e.g. tank HE shell) we'll always force actor so we get ragdoll.

Video of issue:

https://github.com/user-attachments/assets/7a69c6e9-40a4-4fbf-a724-6efb464b4b37