Last updated
Last updated
To sway mean to move or cause to drift slowly or rhythmically backwards and forwards or from side to side.
The Sway component is an integral part of any game, and we wrote it to make objects look like they are following the player, and swaying when they turn instead of just standing motionless.
It achieves this desired outcome by pushing the objects in the direction opposite to the one the player is rotating on.
Just like the effect, this component changes both the position and the rotation of the object by applying small values; The only difference is that we apply this effect as the player rotates their camera, as opposed to when moving.
The swaying effect works by taking the player's mouse input and multiplying it by the two variables that can be used to tweak the script, the results are then multiplied by the multiplier for the component, and then applied as a force trough the Handle.
When changing this motion, the only things to keep in mind are the two force variables, the position
and rotation
fields, which determine the forces that will get applied to the position and the rotation of the object.
Aside from those two fields, it is important to note that the effect has a multiplier in the , and also has for both the position and the rotation.