Last updated
Last updated
To fall means to move from a higher to a lower level, typically rapidly and without control.
With this component, its effect makes an object react to the player’s falling speed by moving backwards and tilting upward; this motion is important on the camera and guns the player has.
The way we built this effect is by taking the player’s velocity on the Y axis, meaning how much he is moving up and down every frame.
We then store this value and check whether or not the player is falling; this can be easily done by checking if the velocity on the Y axis is bigger than zero.
If the player is falling, we push the object back according to the position
field, only on the Z axis; The camera is also rotated based on what the value of the rotation
field is.
To tweak the effect you can change the position
and rotation
values, these determine the movement and rotation of the object when falling.
Something important to keep in mind is that it doesn’t matter whether the position
value is positive or negative, as the object will move backwards either way.
The for the player’s current state has a multiplier for this effect.