自己流() Unityで弾を飛ばすスクリプト

コメント文は自己解釈でありもしかしたら間違ってるかもしれません。もし間違ってたらDMでこっそり教えていただけると助かります・・・
ちなみにアタッチしてるオブジェクトの向きに弾が飛びます

コメント文は自己解釈でありもしかしたら間違ってるかもしれません。もし間違ってたらDMでこっそり教えていただけると助かります・・・
ちなみにアタッチしてるオブジェクトの向きに弾が飛びます

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class copy : MonoBehaviour
{
//
public GameObject gm;
//
GameObject copied;
//
public float speed=50.0f;
//
Rigidbody rb;
//
public float dlt_sec=10f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
//or
if (Input.GetMouseButtonDown(0)|| Input.GetMouseButton(1))
{
//copied
copied = Instantiate(gm, this.transform.position, this.transform.rotation);
//(copied)
rb = copied.GetComponent<Rigidbody>();
//(copied)
rb.AddForce(transform.forward * speed);
//(copied)dlt_sec
Destroy(copied, dlt_sec);
}
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX