How do you animate a gun where the gun mag is part of the animation?

Didn’t know how to word it but basically, how do you make an animation where you can essentially pull the magazine out of the gun, throw it away, and put in a new one? I have good knowledge of how to animate rigs, but I’ve never attempted this before. Any idea how I could do this?

4 Likes

When the animation reaches the keyframe to grab the mag, create a second, “fake” mag at the real mag’s CFrame, and weld it to the hand. Make the original mag transparent, so only the fake mag is visible. When you reach the drop keyframe, make the fake mag invisible and clone a new, unanchored/unjointed mag in its place and let physics do its work. When you get to the keyframe where the player pulls out a new mag, make the fake mag visible. When you reach the keyframe where the mag is inserted, destroy the fake mag and make the real mag visible again.

Ideally we’d just be able to use the one mag and clone it for the drop, but Roblox animations / animation editor don’t support this very well like more fleshed out tools such as 3DS Max.

11 Likes

Alright, I understand that, but how would I handle making the mag visible/invisible, Cframe, etc in the middle of an animation? Or can this be done in the animation editor?

1 Like

So there are multiple ways to do this. The first option is to weld the magazine part to the character’s hand. This is complicated, but EchoReaper explained it well. The other method which I use, which fixes some issues I ran into with the previous method, is to code each keyframe manually through Motor6Ds. This is really complicated to do and takes a lot more manual work, but I was able to perfectly time the welding of a part to the character’s hand. This also allows a little more freedom and control with the animations. It’s up to you but both work.

1 Like

My other question still stands however, how do I actually handle the welding/creaming? Is this in the animation editor or do I have to script this and time it.

1 Like

You’ll have to script it. Roblox animations don’t handle external parts.

3 Likes

Thank you both for helping!

Note that it looks like renaming keyframes is currently broken in the animation editor. You’ll need to save (not publish) your animation, change the names of the keyframes manually under SavedAnims, and then open the saved animation again in the editor.

https://gfycat.com/SlightLeftIvorybilledwoodpecker

1 Like

Currently you can’t close and reopen the animation editor either, you have to restart your game. Selection of rigs breaks, and the GUI doesn’t open. I’ll submit a bug report later on.

3 Likes