Strafe
Strafing is the act of moving sideways in a video game, typically either in relation to an enemy or the game's camera. Strafing sideways allows a player to keep the camera focused on something, such as an enemy while moving in a different direction.
Description
We created the Strafe component as an addition to the Bob and Roll scripts, with its main aim being to make an object look like it's in the player's hands when they move sideways; It achieves this effect via a clever combination of small movement and rotation changes.
How does it work?
This component creates the desired effect by checking the player's input on every frame and applying a position and rotation force multiplied by the input. It only applies forces when the player is moving, as the value of the input is zero otherwise, and thus the final force will have no value.
As with all the Motion Effects, there is an additional multiplier taken into account besides the player's input, that being the State Data multiplier for this effect.
The main purpose of this effect is to work as an addition on top of others, and thus its functionality is not complex. It can still add a lot of interesting movement to your game by using it though!
Tweaking the effect
There are two main things that you can change when adjusting this effect, those being the position
, which decides how much the object moves as the player moves and in what direction, and the rotation
, which decides how much to rotate and in what direction.
There are also Spring Data variables for both position and rotation, changing those will make the effect's springs behave differently, and lastly there is the effect's multiplier, which is in the State Data.
Last updated
Was this helpful?