Skip to main content

SmallProjectile

A class in Root.Township, the global namespace.

Server-side sweep test for small fast projectiles: sphere casts along the rigidbody's velocity each physics step so thin hits aren't missed, and passes hits to a trigger impact tool.

Constructors​

MemberWhat it is
SmallProjectile()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Transform cachedTransformCached transform of the projectile.
private LayerMask hitLayersLayers the sphere cast hits.
private NetworkRigidbody networkRigidbodyNetwork rigidbody whose velocity drives the cast.
private float sizeSphere cast radius.
private TriggerImpactTool triggerImpactToolImpact tool that handles the hit.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Removes the component if size is not set.
private void FixedUpdate()Sphere casts over the last step's travel and sends the first hit collider (not itself) to triggerImpactTool.
private void OnValidate()Editor: takes size from a child sphere collider's radius when unset.
private void Start()Enables the component only on the server.