[Solved]How do I get a cannonball splash effect?
This sounds easy, but for me I've been hitting my head against it for over two days. Anyway, I'll keep it simple. Two objects: cannonball with particle effect, ocean with script to trigger splash and to destroy splash and cannonball x seconds after they hit the water.
My idea is this: Cannonball hits ocean, ocean fires particles, ocean grabs particles as a child (so particles stay right where they hit), then oceans destroys ball and emitter after x seconds (cannonball earlier, particles later).
Problem: Took a bit but here is the issue. The particle system doesn't fire. What am I overlooking?
using UnityEngine;
using System.Collections;
public class CannonballEater : MonoBehaviour {
ParticleSystem mySplash;
private void OnTriggerEnter(Collider other)
{
mySplash = other.GetComponentInChildren<ParticleSystem>();
mySplash.Play();
mySplash.transform.parent = this.transform;
if (other.tag=="Cannonball")
Destroy(other.gameObject);
Destroy(mySplash.gameObject, 5f);
}
}
Answer by YithPistol · Feb 11, 2017 at 04:09 PM
Got rid of reparenting. Used Instantiate at the position of the cannonball at the point it entered the trigger. This worked.
Your answer
Follow this Question
Related Questions
Triggering Particle With Box Collider? 0 Answers
ParticleSystem and trigger... 0 Answers
How can I rapidly trigger the same particle system? 2 Answers
Detect the objects staying on top of the Particles 0 Answers