Author Topic: Animating separate parts of a weapon [Solved]  (Read 1178 times)

I'm trying to make a DM gamemode based on the game Receiver. Is it possible to create a pistol-type weapon, using only the state system and properties of the model, that has multiple parts that animate separately (e.g. slide, hammer, safety, mag, chambered round)? If not, is there another accepted approach to things like this?
« Last Edit: December 10, 2015, 10:52:19 PM by ThinkInvisible »

It should work if the animations are blended, though I've never done it myself.

Made a model and (hopefully) animated it right. Is there any way to trigger states or image animations manually? I don't see one in -image name-.dump().

Made a model and (hopefully) animated it right. Is there any way to trigger states or image animations manually? I don't see one in -image name-.dump().
no i don't think so
its one of the things that tge needs but doesn't have

You can use imageAmmo and imageLoaded to call different states, thus manually start different animations through your code. It's a bit contrived though.

You can use imageAmmo and imageLoaded to call different states, thus manually start different animations through your code. It's a bit contrived though.

Poor example: https://github.com/portify/Weapon_Package_Complex/blob/master/weapons/Revolver.cs#L120

Got the code working, but all my animations either do nothing or cause random parts to twitch around. Is there some specific way to organize animations for blending? As it stands I just set everything to start on frame 1 and end 2-8 frames later. Also, what exactly should I assign to the 'ref pose' frame in the exporter?

I would suggest animating each individual 'stance' that the gun takes in order to reload. You CANNOT animate individual parts, groups, or joints and have the engine blend them together. Here's a receiver type animation rig I would expect

root (gun is being held normal, also known as 'ref pose' I suggest you set this to the first keyframes.)
fireanim (slide moves back and forward quickly)
holdsidetransition (transition into holdside)
holdside (when you hold the gun to the side to change it etc)
holdslideback (when you slide it back)
holdslideforward (when you slide forward)
holdmagremove (when you remove the mag with the slide forward)
holdmaginsert (when you insert the mag with the slide forward)
holdmagremoveback (when you remove mag with slide back)
holdmaginsertback (when you insert the mag with slide back)
returntoroot (transition to root)

IMPORTANT: FOR NON-LOOPING ANIMATIONS LIKE SLIDEBACK, YOU CAN STOP THE ANIMATION KEYFRAME WHEN THE SLIDE IS FULLY BACK AND THE MODEL WILL TAKE THAT POSITION PERMANENTLY OR UNTIL THE NEXT ANIMATION IS LOADED.

You can assign each animation to allocated frames, like root to 1-8 and fireanim to 12-15, etc
When you go into the weapon code later you can set up a conditional/iterative state system that replicates the receiver-style reloads.
« Last Edit: December 10, 2015, 09:50:39 AM by Path »

Well I also have the safety, hammer, and chambered bullet to deal with, so I guess I'll just use some hacky workaround with staticshapes or a playertype.

I really like this idea and have wanted something like this for a while now on Blockland, hope you're able to go through with it!