Last updated
Last updated
An offset is the amount or distance by which something is out of line.
As the quote says, an offset is just the distance out of line, and that is exactly what this component does, move something from its initial state.
Changes in the position and rotation of an object based on the player's current state is what the Offset component is best for.
Every frame the sends the , and as long as it isn’t null (which shouldn’t be possible,) the Offset component adds a translation and rotation force as defined in that data.
To set a position and rotation for an object, you can change the field in the for that object.
The reason an object's position and rotation are not a variable inside the component is that frankly, it would be too limiting; when changing the value inside the script, that value is final, and can’t change easily anymore.
Instead, when setting a value for each state, the spring system can easily change to a new value when the player's state changes, which means we can have things like the camera moving down when the player crouches.