A class in Root.Township, Alta.Intelligence.
Component that turns strong collisions with rigidbodies into a 0 to 1 strength and passes it to an IReceiveImpulseFromCollision on the next frame.
Constructors
| Member | What it is |
|---|
CollisionImpulseReader() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private float strongFlailVelocity | Impulse at or above which strength is 1 (default 2). |
private IReceiveImpulseFromCollision target | The receiver, cast from targetObject in Awake. |
private Object targetObject | Serialized reference to the object that receives the impulse. |
private float weakFlailVelocity | Impulse at or below which the collision is ignored (default 1). |
Methods
2 private and internal methods
| Member | What it is |
|---|
private void Awake() | Casts targetObject to IReceiveImpulseFromCollision. |
private void OnCollisionEnter(Collision collision) | Ignores hits without a rigidbody or with impulse at most weakFlailVelocity; otherwise maps impulse between weak and strong to 0 to 1 and calls ReceivedImpulse later. |