Creating Custom Animations - Nyemse/SPEARHEAD GitHub Wiki
Animation Requirements
Equip animations
Equip animations must have their first keyframe named "Equip". This is used to tell when the equip animation has started playing.
Reload animations
There must be a MagIn keyframe name, once this keyframe is reached the gun's ammo will be updated and the chamber animation will play if auto chamber is enabled.
Chamber and BoltClose animations
One keyframe must be named SlideRelease, this will take a bullet from the magazine and chamber the gun. (This keyframe name can actually be used in any animation and it'll work the same, so you can get creative with it if you'd like
Playing Sounds in Animations
In order for a sound to play in an animation, there needs to be a Keyframe in the animation and a Sound in the gun's Grip with the same name. As long as those two things share the same name, the sound will play when that Keyframe is reached. In the Roblox animation editor, you can rename keyframes by right click on them in the timeline.
Creating Custom Rigs
If an animation requires a model or movement that isn't available on existing rigs, this guide shows how to make a new rig for those animations.
- Duplicate one of the existing rigs and delete the gun from it. It should look like this.
- Next, you'll need to prepare a gun model. Make sure it at least has a Grip, and then any other parts you intend on animating.
- Weld any static parts to the Grip (With either a Weld or WeldConstraint), and attach any parts to the Grip that need to be animated with a Motor6D. I would recommend using Wunder_Wulfe's Constraint Editor as it can speed up this process significantly.
For any guns that will be using this animation, make sure all moving parts are listed in their rigParts setting in their WeaponStats module.
- Unanchor the gun model, and add it to the rig.
- Create a new Motor6D in the AnimBase part and name it "Weapon". Then set its Part0 property to AnimBase, and its Part1 to the gun model's Grip. The gun should then snap into place. (If any parts are still floating, just select them and they should snap into place as well)
- Now the rig is ready to be animated! Always double check that the Weapon Motor6D has blank C0 and C1 properties before creating an animation, as any offset in them will result in animation bugs.