Uploaded March 2019 | Updated September 2026, 1 week ago
One of the toughest parts of this method is detecting the collisions. In this tutorial we script the raycast checking using the newest non-allocating raycast hit detection for fast an accurate hit detection.
We also put it into practice with a simple particle system effect to show the hits.
Stay tunes for more in the series when we look at ways to make this code much more efficient with object pooling.
Apologies!! Bug fix needed!
The second line of the CheckHit() function should read:
float dist = Vector3.Distance(lastPosition, transform.position);
I accidentally used transform.forward instead..... Sorry!
It's fixed in my next vid on Object Pooling
One of the toughest parts of this method is detecting the collisions. In this tutorial we script the raycast checking using the newest non-allocating raycast hit detection for fast an accurate hit detection.
We also put it into practice with a simple particle system effect to show the hits.
Stay tunes for more in the series when we look at ways to make this code much more efficient with object pooling.
Apologies!! Bug fix needed!
The second line of the CheckHit() function should read:
float dist = Vector3.Distance(lastPosition, transform.position);
I accidentally used transform.forward instead..... Sorry!
It's fixed in my next vid on Object Pooling










