반응형 유니티2 [유니티2D] 플레이어 위치로 원거리 공격하는 적 https://insengreview0510.tistory.com/36 [유니티3D] 플레이어 위치로 원거리 공격하는 적 총알 코드 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { // Start is called before the first frame update public float speed = 5.5f; private Rigidbody bulletRigidbody; void Start() { insengreview0510.tistory.com 저번 글에서는 3D에서 플레이어 위치로 원거리 하는 적을 구현했다. 나는 이를 토대로 2D에서.. 2023. 4. 18. [유니티3D] 플레이어 위치로 원거리 공격하는 적 총알 코드 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { // Start is called before the first frame update public float speed = 5.5f; private Rigidbody bulletRigidbody; void Start() { bulletRigidbody = GetComponent(); bulletRigidbody.velocity = transform.forward * speed; Destroy(gameObject, 5f); } void OnTriggerEnter(Collider other.. 2023. 4. 11. 이전 1 다음 반응형