#how to i make the transition between jump animations smooth?
8 messages · Page 1 of 1 (latest)
If understand your code correctly, that LERP_VAL value is a constant and if it is, you're using the lerp() function the wrong way. The documentation in the editor about the function might not be entirely clear, so I'll describe this function in detail and maybe give you some sources.
Basically, imagine a track with value A and value B at each end. As you go down the track, the value slowly morphs into the other value and how much it has morphed depends on how far down the track you went. You want to see what is half-way the track, so you go to 0.5 (or 50%) and check the value. That's what lerp does. Here's a primer for interpolation, also has some useful GIFs.
https://docs.godotengine.org/en/stable/tutorials/math/interpolation.html
If you want to use it for animation, you might want to rethink the approach of when you use lerp() and what value you'll use as weight. Alternatively, you can use Tweens, which should fit better with your use case of smooth transitions between several
https://docs.godotengine.org/en/stable/classes/class_tween.html
If you just want a transition between two animations and you don't want to do any mixing between them (just transitions), then check out AnimationTree's StateMachine node.
https://docs.godotengine.org/en/stable/tutorials/animation/animation_tree.html#statemachine
Interpolation is a very basic operation in graphics programming. It's good to become familiar with it in order to expand your horizons as a graphics developer. The basic idea is that you want to tr...
Inherits: RefCounted< Object Lightweight object used for general-purpose animation via script, using Tweener s. Description: Tweens are mostly useful for animations requiring a numerical property t...
Introduction: With AnimationPlayer, Godot has one of the most flexible animation systems that you can find in any game engine. The ability to animate almost any property in any node or resource, as...
Can lerps be used on variables and parameters?
lerp() function returns a value, so you can use its results as a new value for a variable. The most classic example of eased out camera movement code is to have current camera position and target camera position and lerp between the two in a _process function using delta as the weight. With each frame, the current position draws closer and closer to the target, but each move becomes slower as the difference in distance becomes smaller.
current_pos = lerp(current_pos, target_pos, delta)
Tweens should be able to morph variables too, it's their job. Godot says tween_property is for "properties", but for me it's ambiguous if variables also count. This is one thing you should give a try.
hhmm
Glad I could help! Good luck in your endeavours!
