Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Animation Elation: Show me your moves!

Hello. Ricardo here. 

Recently I've made a series about everything that has gone wrong with animations using Unreal Engine 5. Having become enlightened, I'm trying to have fun with the game while making it instead. I've changed the narrator in my head and I've decided to make another series about things that have gone right instead.

Focus on the good, rather than the bad!

Recently, I changed the way our attacks are handled, or rather their colliders. We used to handle it with the weapon, having a collider turned on and off when attack was called. We were trying to attach it to the weapon, but this resulted in many bugs like the character hitting himself as well as the enemies... And did I mention, MULTIPLE HITS?

Yes, the player was so overpowered, he damaged himself in the process of killing his enemies, but don't we all hurt ourselves in the process of hurting others? Let's tone down the realism.

Even though we hard coded the whole process and fixed every bug, it never felt right. When I started to introduce abilities on the player, I knew it was time to find another way and so came Animation Notify and Notify States.

I wrote code for the player to spawn sphere colliders with every animation attack performed. Basically, you set up your own Anim Notify State and use this to handle the frames in the animation where the attack is happening. Then set your Anim Notify just to notify when your animation is done, in your terms.



Then make sure in your code you attach this small time frame, to the spawning of colliders using a socket in your melee weapon. You definitely need to make sure that your weapon uses a skeletal mesh, that way you can control where this socket is.



And bam! Every sword swing, axe strike, staff pound will have colliders spawning on top of the animation, ensuring all hits line up well with the animation.

Depending on how you set this up, there's so much you can do; you could modify the collider size, how many times it hits, who it hits, where it hits, collider type, etc. 

Something I've always loved about coding is that if you can picture it in your head, you can make it happen

You are the creator God of your game, anything is possible.

NEVER forget that!

By Ricardo Rodríguez (06/17/2024)

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.