Class HeadingTracker
Tracks an object's velocity with a filter to determine a reasonably steady direction for the object's current trajectory.
Namespace: Cinemachine.Utility
Syntax
public class HeadingTracker : object
Constructors
HeadingTracker(Int32)
Construct a heading tracker with a given filter size
Declaration
public HeadingTracker(int filterSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | filterSize | The size of the filter. The larger the filter, the more constanct (and laggy) is the heading. 30 is pretty big. |
Properties
FilterSize
Get the current filter size
Declaration
public int FilterSize { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
Add(Vector3)
Add a new velocity frame. This should be called once per frame, unless the velocity is zero
Declaration
public void Add(Vector3 velocity)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | velocity | The object's velocity this frame |
DecayHistory()
Decay the history. This should be called every frame.
Declaration
public void DecayHistory()
GetReliableHeading()
Get the filtered heading.
Declaration
public Vector3 GetReliableHeading()
Returns
| Type | Description |
|---|---|
| Vector3 | The filtered direction of motion |