Bullet Impact effects

Read Time:1 Minute, 11 Second
SPLAT!

So the big new addition to the system is Impact Handler. Impact Handler is sort of a super Object Pool Handler in that it contains references to n Object Pools where n is the number of Impact materials that we are dealing with. For this demo, there are two Impact materials: Flesh and not flesh.

Flesh is an empty script that I can attach to objects that should play squishy sounds when they are shot. It might not stay empty, but it’s empty for now. I envision that there could be other Impact material scripts to play different sounds.

Nothing to see here.

The Raycast To Target component gets a second event that sends three outputs into the void to be intercepted by who knows what. In this case that would be the Impact Handler component. The event outputs are (1) the collider of the object the raycast hit, (2) the world position of the hit, and (3) the surface normal of the hit. If you scan back up to the Impact Handler code, you can see that the surface normal is used to generate a Quaternion to align the Impact FX properly.

Raycast To Target didn’t really have significant code changes. There is the addition of the Impact Event class and then its invocation. Do note that the Impact event is invoked for all hits, not just Target hits.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleppy
Sleppy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *