I'm building a game where the earth is hit by a meteorite. I have programmed the meteorite hitting the earth and both shapes have a sphere collider. I have also designed the explosion particles.
However, I don't know how to activate the explosion once the meteorite collides into the earth.
Here's my code:
Earth rotation script
using System.Collections.Generic;
using UnityEngine;
public class orbit : MonoBehaviour
{
public Transform world;
public float rotationSpeed=1f;
// Start is called before the first frame update
void Start()
{
world = GetComponent<Transform>();
Debug.Log("this works on the first frame");
}
// Update is called once per frame
void Update()
{
//code for rotating the earth
world.Rotate(new Vector3(0, rotationSpeed, 0), Space.World);
}
}