using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class Bullet : MonoBehaviour {
float speed = 100;
void Update()
{
transform.Translate(Vector3.forward * Time.deltaTime * speed);
Destroy(gameObject, 3);
}
void OnCollisionEnter(Collision collider)
{
if (collider.gameObject.name == "物件名稱")
Debug.Log("aa");
}
}
沒有留言:
張貼留言