BLUF: Trying to make a “hitspark” particle effect fire when the character’s fist hits an object. Instead, it fires shortly afterward - so the particles are inside the target object. I would love any recommendations on how to fix this.
Figure 1: Worst case, with fist all the way inside cube.
Figure 2: Slightly better, but some of the cube’s polygons are still drawn over the particles. See the triangle drawn over the top right corner of the particle effect.
Details:
- The “Fist” is an empty GameObject
- The “Fist” is animated for five frames during the punch animation, to line up with the character’s hand.
- The “Fist” has a Trigger Collider.
- The Collider is only enabled for those five frames (also controlled by the animation).
- OnTriggerCollide, the ParticleSystem is enabled (attached to the “Fist”).
What I’ve tried:
- Manually setting the fist further away from the cube once a collision is detected. But, I can’t seem to override the position set by the animation clip.
- I’ve tried Instantiating a ParticleSystem at the location instead, and it works better. But, i still have the problem shown in Figure 2.
- I’ve tried raycasting forward from the shoulder to determine a more precise hit location - result isn’t improved.
Any thoughts? Anything I can try?