Open CarrotKutay opened 4 years ago
For transition into input -> looks like we need a function in form of an exponential function of second degree, maybe y = 2 * x
would work as well
For transition out of input -> function of need seems to behave y = n / x
We are currently only using one transition function working the same every time we are transitioning to a new animation vector value (right/left/up/down -> or a combination of all these)
Get the current animation vector and add a fixed 'tranistionSpeed' onto it (default lies at 0.002f currently). This in itself is a linear transition. But we have an addition of calculating a momentum if an input is pressed for longer periods of time, which will speed the transition up.
-> every time the transition per update is the same as the previous transition update, we gain momentum equal to 'DeltaTime' * 2
As canceling movement equals stop pressing movement related input buttons, it can be seen as receiving a new animation vector order to AnimationMoveVector = Vector2D(0, 0);
Therefore, we don't need a separate transition method to cover movement canceling for now.
noticed buggy behavior: changing movement rapidly between different (and opposite directions) will result in very slow start up animation. Creating Bug issue. See #9
Input System - Movement Transition
As we are working with the new input system we will have 3 points to access input events once they are fired #6
1) Creation (Once the input event is invoked) 2) Performed (Once the input event is successfully fired) 3) Cancellation (Once the input event has to be cancelled as firing conditions for performing the event can't be met after starting/creating the event, e.g. hold duration)
These three access points allow (for now, InputSystem package v.1.0.0) not a continuous firing for changing events, but will only fire once per input received (hold actions will only be seen by the time between push and release).
As we want to transition between different animations for movement inside the blend tree handling moving animations, we will need to handle transitions between input as well.
Suggestion
-> two seperate Transition functions
1. Function to transition into input
This function will transition into the input received. Possible transition is either linear which in case of movement seems unnatural. Therefore, I am suggesting bi-linear transition with a slow start (speed up) and a fasting once 'velocity' in transition and movement is gained.
2. Function to transition out of input
This function should transition out of the input once the input is released/stopped. Same as before, a bi-linear transition seems more natural. This time however the start of the transition should be fast and the final process of stopping/ending the transition and movement should be slowest.
Realization
The input received through the new input system will be in form of a 2D Vector of floats.
Needed for both functions:
Need for each function: