RaycastProjectile
A class in Root.Township, the global namespace.
Projectile hit check that sphere-casts along the rigidbody's velocity each fixed update instead of relying on colliders. By default it only runs on the server.
- Listed in Global namespace: Q to R
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
RaycastProjectile() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private ColliderAltaEvent collided | Inspector event fired with the hit collider. |
private LayerMask hitLayers | Layers the cast can hit. Triggers are ignored. |
private bool isOnlyOnServer | When true (default), StartRaycasting only does anything on the server. |
private bool isStoppingAfterFirstHit | When true, stops casting after the first hit. |
private IUnityUpdateMethod raycastUpdate | Handle for the registered fixed update method. |
private float size | Radius of the sphere cast. |
private Rigidbody targetRigidbody | Rigidbody whose velocity sets the cast direction and length. Hits on it are ignored. |
private Transform targetTransform | Transform the cast starts from. Defaults to this object's transform. |
Events
| Member | What it is |
|---|---|
event Action<RaycastHit> OnCollided | Fires with the RaycastHit each time the cast hits something not on the projectile's own rigidbody. |
Methods
| Member | What it is |
|---|---|
void StartRaycasting() | Registers the per-fixed-update cast. Does nothing on clients when isOnlyOnServer is set. |
void StopRaycasting() | Deregisters the per-fixed-update cast. |
3 private and internal methods
Used in
Members of other types that take, return or hold a RaycastProjectile: