Hi everyone! In my hotline miami like game I have two weapon scenes: katana and knife. In player scene I have one AnimationPlayer with two animations in it: “katana_attack” and “knife_attack”. Also player has the node “Weapon” with weapon scene (katana or knife) in hands. Player may have only one weapon in Weapon node.
The problem happens when the player has knife. Terminal starts blasting with errors that katana animation can’t reach katana scene position, rotation, etc. Similar thing happens with katana in player hands but now terminal throws errors about knife position? rotation, etc.
How can I fix this problem? I call attack animation dinamically according to weapon in hands but still missing weapon causes trouble.
Hi! Brilliant idea!!! Thank you very much)
But unfortunately here comes another problem)) In my AnimationPlayer I change katana’s position, rotation and collision layers (so the Player can hit Enemy only when the animation is going and not just by touching Enemy with katana without animation)
So if I animate parent Weapon 2dnode instead of area2d(katana or knife) I could not access theur collision layers(((
I know my collision layers sollution sounds a little sloppy. Do you know the better way?
thank you for your help! But I don’t know how to make my animation show via script… It would be great to load for example knife_attack script when Player have knife in hands but I couldn’t find working solution for this(((
Maybe set the AnimationPlayer’s root to the weapon, but you would have to update the root when the weapon changes. The animation track paths would look like .:position, .:rotation which does not require any specific naming, only that the properties exist.
On the other hand you could name the weapons the same thing, instead of Katana/Knife rename them when added to “Weapon”. Then the animation tracks would work without error as Weapon:position should always exist.
Guys, thank you very much for all your help and thoughts! I came up with a solution)
I just made animation player empty and add specific animation library with weapon specific animation via Player script. It was so simple, sorry for such a noobie question((
Thanks again!!!