Download

Animation triggered from Speed

Hi there

I have a space ship and i need to trigger the animation depending on speed so when the speed gets over say 5% or say 0.5 it will play an animation to change the wing shape and when the speed drops below 0.5 it plays the animation to put the wings back

I know my Animation works as i have it on a KeyBind at the mo but i cant figure out how i can link this to the speed of the ship

If you can help that would be great thank you.

Hi @john.helyar,

Not certain how or what code you have. But, based on your description I would create a Custom Event to Trigger the Animation. Then use a ‘>’ conditional check for Speed. IF Speed >.5 Fire Animation Custom Event.

Psuedo Blueprints

Good Luck

Interesting, maybe this is how games have an aircraft landing gear come out when you are close to the ground. Will keep this in mind for future reference.

Hi there

Thanks for the advice im a bit stuck on how to add it to my code though so hopefully if i have done it correctly here is my BluePrint for both the main engine and the Animations

BluePrint

@john.helyar

Replace the ‘Right Button’ Input Action Event with the Custom event.

I would just set up a state machine. Normally you read the speed values into the AnimBP anyway.
Hook into that and remember that normally 5% is .05 NOT .5 which is 50%.
Speed is it’s own thing though, you have to figure out what your max speed is and precompute the math. OR, you can convert it with a map range clamp to go from the actual values to 0 to 1 and get back to the stuff below.

Like a jump, 3 states for it. Transition in, hold wings open, transition out.

Similar to a jump, enter if speed is > .05, remain in state until speed is < .05.

The transition states both need to have loop disabled and a rule to transition to the next state based on the animation having finished (you should be able to click the auto transition checkbox too).

Since this is a constant behaviour the way you describe it, there is no need to trigger anything except for to read the speed and utilize it as the starting point for animations transirions.