A class in Root.Township, the global namespace.
Drives a TrailRenderer's width curve from how fast the object moves along chosen axes, so a weapon trail only shows on fast swings. Runs in edit mode too.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour
- Attributes
RequireComponent, ExecuteInEditMode
Constructors
| Member | What it is |
|---|
SwordTrail() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private Vector3 axisSize | Weights per axis for how movement direction turns into width. |
private List<Keyframe> keys | The width curve keyframes. |
private Vector3 lastPosition | Position at the previous physics step. |
private float minSpeed | Squared distance per step below which the trail width is 0. |
private int numberKeyFrames | Number of keys in the width curve. |
private TrailRenderer trail | The TrailRenderer on this object. |
Methods
3 private and internal methods
| Member | What it is |
|---|
private void FixedUpdate() | Pushes a new width from the movement since last step, or 0 if it moved less than minSpeed. |
private void Start() | Caches the trail and builds the starting width curve. Integer division makes all keyframe times 0. |
private void UpdateList(float newValue) | Shifts the width keys along by one, puts the new width first and applies the curve. |