Flashlight animation when pressing F

Hello fellow developers.

I am finishing the demo of my game soon ,a horror game, but i am facing a few problems yet . I would like to ask you how to solve one of them . What i would like to do is starting without a flashlight , then finding the flashlight and pressing E will make you pick it up. This will change a bool variable to true and you will be able to toggle the flashlight by pressing E. All fine until now , i have done all of them . What i need to to do now is when i press F , my player should get the flashlight out and just keep it on air holding the flashlight . When the player presses F again then the hand should return to normal position . I know there are similar posts to this , but they have not helped me too much . Also I want to point out that i do not have this kind of animation so it would be very helpful to send me links or explain me how to create this animation and then apply it to my player .

Thank you very much ,
VortX

you will need to aquire the animation first either by buying one on a market place, finding a free download, making it yourself, or hiring someone. im not sure of where you can buy one but i would check mixamo, itch, and any other marketplace site you can find. if you wanted to create the animation you could do that as well and i know theres a bunch of tutorials about how to animate in programs like blender, max, and maya. it may look a little rough doing it yourself if its your first time, but like anything you get better with experience.

now on how to implement it in the engine. you said that you have setup a method to pickup the light and a toggle for the light as well, thats a good start. now from here you want to look into doing a per bone blend in your anim bp so that your flashlight animation only affects from say the waist up, enabling you to still walk around. alternatively you could also just add a section to you anim bp that has animations that only affect the upper part of the mesh though thats beyond my knowledge. now if you decide to setup the flashlight anims in the character instead of overhauling the anim bp then you will probably want to use montages. you can probably get away with 3 montages, a pull out flashlight animation, a put away flashlight animation, and a loop for when its out (if needed).

so when you hit the button to pull out the flashlight it would also play the montage. at the same time based on a anim notify you would spawn the flashlight or make it visible, and enable its light component. then when your done with the flashlight do the opposite, play montage, hide / destroy flashlight, disable light component.

1 Like

Thank you very much for the help. You should change the comment to answer so I can accept it.