Trying to make a 'Laser' spell. Does anyone have a snippet for a multi-hit raycast? I want the beam to pass through the first mob and hit the second one, but lose 50% damage per hit. My current script just stops at the first collision.
Trying to make a 'Laser' spell. Does anyone have a snippet for a multi-hit raycast? I want the beam to pass through the first mob and hit the second one, but lose 50% damage per hit. My current script just stops at the first collision.
You need to use Physics.RaycastAll(). It returns an array of hits sorted by distance. Then just iterate through them and apply your damage reduction logic in a loop.
You need to use Physics.RaycastAll(). It returns an array of hits sorted by distance. Then just iterate through them and apply your damage reduction logic in a loop.