So I’m making a game where you are a wizard that fires fireballs. The fireballs have a script:
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveTrail : MonoBehaviour
{
public int moveSpeed = 15;
void Update()
{
transform.Translate(Vector3.right * Time.deltaTime * moveSpeed);
Destroy(gameObject,1);
}
void OnCollisionEnter(Collision collision)
{
Destroy(gameObject);
}
}
I want them to get destroyed when they hit a wall but now they just stop at the wall and slide to the side. They have a rigidbody2d and a box collider. They are made from a sprite and a trail, which are children of the fireball. I have checked every forum question that I could find and they all said the same thing.
I am sorry if this is just a little mistake but it’s my first time using Unity. Thanks for help