Hi all, I currently have a scene where there is a skeletal mesh in the level (NOT a character/AI/etc) that I want to have a looping animation playing on. Once the player enters a trigger volume, I want the animation of the skeletal mesh to change to a different one. The issue I’m running into is how to do this smoothly since the player could trigger the change at any point of the first looping animation. I want to avoid the mesh just popping into the next animation when triggered and would like it to blend smoothly into it. I set up a Blendspace1D that does exactly what I’m looking for in terms of blending the animations, but I’m unsure how to trigger the change with a trigger volume.
In theory I would like to animate the variable of the Blendspace1D over a certain time to blend between them. Is this possible in matinee or something? I’m unsure how to access that variable for anything other than a playable character.
Cast to the anim BP on begin overlap, by doing a Cast to skeletal mesh > Get Anim Instance > Cast to skeletal mesh anim BP
Have it fire into a custom event in the anim BP that plays a Timeline that has a float track going from value 0 to 1 over whatever amount of time you would like this blend to occur
Output the float track into a float variable, being set on Update of the Timeline
This variable will be hooked up to your blendspace 1D animation in your anim graph
I would recommend setting the blendspace X axis to 0 to 1, since you are simply blending between two animations with what is essentially an alpha. If you need to keep it to some other set of values, like 1-20 or 1-300, go back to your Timeline and multiply the outgoing float track by whatever is needed, like floatTrack20 or floatTrack300, respectively.
Timelines can be reversed too, either at the point it was playing at or starting from the end of it. This will allow you to blend your animations forward and backward however you like.
Lemme know if you need pics or anything if this doesn’t quite do what you’re needing. If the latter, perhaps give me more details.
Here’s a detailed guide, and I corrected a couple minor errors in my original answer. Apologies for that. Likely as a result of typing an answer without drafting it in-engine.
Create a Timeline in your skeletal mesh BP. Set the length to 1 at the top. Add a float track. Right click to add keys. Set a key at 0,0, and another at 0,1. This is an alpha blend over the course of 1 second. Adjust this length as needed.
Apparently, Blendspace 1D has a minimum value range on its X axis of 0-100. Set anim 1 at 0 and the second at 100.
In your anim state in the anim BP of your skeletal mesh, plug in your Blendspace 1D as the pose. Create a new variable, like Alpha, and plug it into the blendspace. Go to the variable and make sure Editable is checked, so it can be accessed from other BPs.
In your skeletal mesh BP, create a custom event, like Anim 1 to Anim 2. Have it cast to your skeletal mesh’s anim BP, using Get Anim Instance as the input. From the cast, fire into Play on the Timeline, and drag the output pin of the cast and type Set Alpha to set the variable you made in the anim BP. Set it on Update of the Timeline. Plug the custom float output of your Timeline into the set node, using a 100 multiplier so it goes from 0-100 for the blendspace.
Finally, on your overlap event, cast to your skeletal mesh get using a Get All Actors of Class node, breaking the result with a Get, and sending it into the cast. Use the output of the cast to access your custom event by simply typing it in.
Ah okay. Then what you’ll want to do is make it a blueprint. Then everything should work out. And make sure you’re including that custom event within the bp you make of it
This seems VERY close to what I need. The last image/steps I kind of get lost on. The mesh I’m playing these animations on is just a skeletal mesh in the world, not a character or AI, so I can’t quite access the custom event with these steps. Any other ideas for that? Thank you so much so far, this is really helping!
I got it working now! Your guide steered me in the right direction. Thank you so much!
My steps for anyone else that may need to do something similar:
I added the skeletal mesh to the level from the browser and plugged in my animation blueprint (which was set up the same way as in the second picture in DG Cage’s Answer). From there I converted the mesh to a blueprint and in the Event Graph set up the exact same setup as in DG Cage’s first and third images (with the timeline set up in the first image and the overall Event Graph setup being the third).
From there, since it wasn’t a character but just a mesh in the world, I simply added a trigger to my level and in the Level Blueprint, made an on overlap event for the trigger, added a do once node to that, and from there just added a call to the Custom Function by right clicking, typing the name I gave it, and plugging the output of the do once into that. Works a treat! Thanks again!
Hello. Could you post pictures of your blueprints? I did everything it said in here. Like you, its a skeletal mesh (not a player or an AI). Still I cannot make it work.