x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Canceling an anim on skeletal mesh to play a new anim,

I know I must be overlooking something very simple here, the situation is this: I have a sniper rifle in my FPS project. It has a reload animation where I load rounds one by one into the breach. The gun is animated as a skeletal mesh using "Play Animation" nodes, attached to a socket in the arms mesh, and the arms are animated via state machine and montages.

I have five different anims for arms and gun, depending on how many rounds are needed (reload one, reload two, reload three, etc) and a sixth anim called reload out, where the arms just move the bolt forward and down and we return to idle. There are notifies in all the reload anims to let us know if it's OK to cancel out and play the "out" animation.

My problem is the "out" animation never plays on the gun - only the arms. Instead, as the arms are playing their "out" montage, the gun finishes whichever reload it was playing (you see floating rounds getting loaded into the breach, bolt goes forward and down).

I've tried a couple different things, such as setting up all the gun anims as montages (this actually made things worse - those never seemed to play despite setting a proper slot) and setting up a state machine in a new anim BP for the gun itself. That actually didn't work as well as using "Play Animation" nodes for things like firing, occasionally the "fire" state would not work and the gun wouldn't fire.

At this point I've spent around 4 hours on the issue and was wondering if anyone out there might have an idea of how to achieve this canceling-out-of-reload functionality. Any advice would be greatly appreciated! ,

Product Version: Not Selected
Tags:
more ▼

asked Feb 11 '18 at 12:14 AM in Blueprint Scripting

avatar image

kgkraeer
26 1 1 5

avatar image Dino zavr Feb 11 '18 at 08:02 AM

Well, you can try to set an empty state machine for the gun, and add a default slot for montages in anim graph.

There is a known bug, you should open the montages to load them after creating, otherwise they won't work ingame.

In the events, you can get skeletal mesh and get its anim instance, where you can check if montage is playing/stop any montage/play montage, keep in mind you don't need to specify a montage when stop or check, if you leave it empty it will stop the current one.

avatar image kgkraeer Feb 11 '18 at 07:04 PM

Excellent, thanks for the advice! Will try that today. Also have you used "Sections" at all in montages? Was thinking of looking into that as well. Was poking around the forums and from what I can tell, loading the rounds could theoretically just be a loop of one round going in, and then a section marked "out" where the bolt goes back forward. Though I think I tried this with my shotgun at one point and ultimately decided on the "brute force" method of anims for each quantity of shells needed, which you can break out of using notifies.

Anyway, thanks again for taking the time to respond, I really appreciate it!

avatar image Dino zavr Feb 12 '18 at 06:05 AM

Well, the sections are not blending together, i mean you would not put 2 different animations on a section, sections are needed if you have 1 big animation that cut aparts, where you would like to process it forward or backward by some events, like (start/mid/loop/end), where blend is not needed.

avatar image Dino zavr Feb 12 '18 at 06:08 AM

Actually you can just use single loop montage for hand and gun while loading rounds, and when its no longer needed, just play another montage on them(it will stop the current one), or just cast to the anim instance, and stop montage with blend.

avatar image kgkraeer Feb 12 '18 at 04:48 PM

Thanks - actually that is exactly what I did. My problem was that I was playing the montages for reloading by casting to the anim instance of the weapon mesh in one area of the event graph, but I was doing the "reload out" montage on another anim instance of that mesh in a different area of the event graph. So each they didn't know the other existed. By forking the anim instance pins for the reload anims and dragging them all the way over to where the reload out montage was getting called, it worked. The reload out montage takes over and interrupts the previous montage being played in the anim instance. Thanks again for your help!

avatar image Dino zavr Feb 12 '18 at 08:16 PM

no problem mate, you can also save anim instance reference as variable after getting it(by beginplay or other way), thus way you can always purely call it to play your anim, btw also you don't need to cast to specific anim instance, play/stop/check montage node works directly from anim instance reference itself, good luck.

avatar image kgkraeer Feb 13 '18 at 03:34 PM

Thanks! I'll see if I can clean things up using that method this weekend.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question