11,000원
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
인벤토리 끄고 퀵슬롯 아이템 드래그앤 드랍시 공격
GunController.cs의 Update()문에서 void Update() { if (isActiviate) { GunFireRateCalc(); if(!Inventory.inventoryActivated) { TryFire(); TryReload(); TryFineSight(); } } } 인벤토리를 끄면 공격을 하게끔 되어있습니다.하지만 마지막 최종 테스트 강의을 보면 강사님은 인벤토리를 끄고 우클릭으로 드래그앤 드랍을해도 공격을 안하는 모습이 보여집니다. 왜그런지 답변 부탁드립니다.
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
멀티로 개발하고 싶으면 어떤것을 알아야할까요?
해당 강의를 수강하고, 공식서버가 아니고, 한명이 호스트가 되고 친구를 초대해서 같이 할수 있게끔 개발을 해나가고 싶습니다.어떤부분을 참고하면 좋을지에 대한 방향성 제안이 가능할까요?
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
유니티 3d 터레인 브러쉬 문제
유니티 3d 터레인 사용을 하는데 브러쉬가 read-only 라고 하면서 사용이 안됩니다 혹시 푸는 법 아시나요
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
moveposition 문제
move함수에서 다음 프레임까지 움직이는 거리가 0으로 나올때가 있어서 movecheck에서 walk가 true, false 값에서 계속 왔다갔다 하네요. 버그인가요? 수정하는 법 좀 알려주세요
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
navigation bake한 후 오류
navigation bake한 후에 돼지를 때리는데 돼지를 raycast의 hitinfo로 가져오지 못하네요 왜 그런 걸까요?closeWeaponController의 CheckObject()메소드입니다layerMask에는 player랑 ignoreRaycast만 체크해제 되어 있어요 protected bool CheckObject() { if (Physics.Raycast(transform.position, transform.forward, out hitInfo, currentCloseWeapon.range, layerMask)) { Debug.DrawRay(transform.position, transform.forward * 15, Color.red); Debug.Log("raycast 체크 오브젝트" + hitInfo.transform.name); return true; } return false;
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
무기 교체 오류
무기 교체하려는데 이런 오류가 떠요KeyNotFoundException: The given key '맨손' was not present in the dictionary.System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)뭐가 문제일까요?
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
gun애니메이션이 손만 작동하고 총은 가만히 있어요
gun애니메이션이 손만 작동하고 총은 가만히 있어요총만 애니메이션 작동이 안 되는 건 어떤 문제일까요?
- 해결됨[유니티 3D] 실전! 생존게임 만들기 - Advanced
34:49 내용 생략 부분
34:49~ 36:40 부분은 흐름이 이상한 부분입니다. (뒤에있는 내용이 그대로 들어가있는 것으로 보아 편집미스로 보입니다.) 처음보시는분들은 34:49 까지 보신후 36:41로 건너 뛰십시오. 유튜브 발췌.
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
고화질 서비스 안되나요..
720p는 눈이 너무 아파요
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
바닥에 있는 아이템이 사라지지 않습니다
아이템 관련해서는 오래전에 작성하고 더이상 건들이지 않았는데 건축 강의 수강중에 아이템 버그가 생겨서 자신이 아이템을 먹고 다시 뱉은 후 다시 주으면 바닥에 있는 아이템이 사라지지 않고 계속 남아있어서 무한적으로 먹을수 있게 되는데 NullReferenceException: Object reference not set to an instance of an objectQuickSlotController.IsActivatedQuickSlot (System.Int32 _num) (at Assets/Script/UI Script/QuickSlotController.cs:152)Inventory.AcquireItem (Item item, System.Int32 count) (at Assets/Script/UI Script/Inventory.cs:77)ActionControllor.CanPickUp () (at Assets/Script/Player/ActionControllor.cs:111)ActionControllor.TryAction () (at Assets/Script/Player/ActionControllor.cs:50)ActionControllor.Update () (at Assets/Script/Player/ActionControllor.cs:41) 이렇게 널래퍼런스가 뜨는데 스크립트 들어가 보아도 잘못작성한게 없는데 왜 이렇까요
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
전체 프로젝트 파일 받을 수 있을까요?
강의를 보고 코드를 치다가 한두 곳 오류가 나왔는데 문제점을 도저히 못 찾겠습니다. 그래서 전체 프로젝트를 보면서 비교 분석해보고 싶은데 가능 할까요...?
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
질문 있습니다
강의를 보면서 만들고 있는데 이상한 점이 있어서 질문 드립니다. SubMachineGun에 Animator가 적용이 안되어 있는것 같은데 어떻게 적용하나요?
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
움직이며 정조준을 하니까 총의 포지션 값이 이상해지네요;; 어떻게 해결해야되나요?
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
Quaternion 값은 왜 곱하나요?
myRigid.MoveRotation(myRigid.rotation * Quaternion.Euler(_characterRotationY)); 부분에서 쿼터니언으로 바꾸는 부분까지는 이해가 가는데 왜 두 값을 더하는게 아니라 곱하는지는 이해가 가지 않네요
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
Hand를 main camera에 넣으면 오류가 생깁니다.
안녕하세요! 강의 잘 보고있습니다! 다름이 아니라 팔 구현하는 강의에서 카메라 이동에 팔이 안따라오는 문제를 해결하기 위해 Hand Holder를 카메라 안에 넣는 내용이 나오는데 저는 넣으면 항상 이렇게 팔이 얇아지고 카메라의 원점을 기준으로 바뀝니다..! 혹시 해결 방법이 있을까요? - 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
웨폰 매니저 강의중 똑같은 내용 영상 중복됨
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
공격성을 띄고있는 동물이 죽어도 계속 쫓아옵니다.
분명 !isDead를 업데이트문에 알맞게 넣어주었고 도망형 AI는 잘 작동하는데 공격형 AI는 죽어도 자꾸 쫓아오고 공격하는데 어떻게해야하죠
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
시야각 구현이 제대로 안되는데 어떻게 해결해야하나요.
시야각 구현이 잘 안됩니다.. ViewAngle값을 아무리 많이 줘도 첫번째 스크린샷처럼 정면, 정면에서 진짜 살짝 벗어난정도 뺴고는 인식을 못합니다. 영상의 돼지들은 레이로 표시한 시야각만큼 플레이어를 인식 해주는것같은데 말이죠.. 코드를 어떻게 수정해야 제 문제를 해결할 수 있을까요? 현재 FOV의 코드는 다음과 같습니다. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class FieldOfViewAngle : MonoBehaviour { [SerializeField] private float viewAngle; // 시야각 [SerializeField] private float viewDistance; // 시야거리 [SerializeField] private LayerMask targetMask; // 타겟 마스크 (플레이어) private TPSCharacterController thePlayer; private NavMeshAgent nav; void Start() { thePlayer = FindObjectOfType<TPSCharacterController>(); nav = GetComponent<NavMeshAgent>(); } public Vector3 GetTargetPos() { return thePlayer.transform.position; } private Vector3 BoundaryAngle(float _angle) { _angle += transform.eulerAngles.y; return new Vector3(Mathf.Sin(_angle * Mathf.Deg2Rad), 0f, Mathf.Cos(_angle * Mathf.Deg2Rad)); } public bool View() { Vector3 _leftBoundary = BoundaryAngle(-viewAngle * 0.5f); Vector3 _rightBoundary = BoundaryAngle(viewAngle * 0.5f); Debug.DrawRay(transform.position + transform.up + transform.forward, _leftBoundary, Color.red); Debug.DrawRay(transform.position + transform.up + transform.forward, _rightBoundary, Color.red); Collider[] _target = Physics.OverlapSphere(transform.position, viewDistance, targetMask); for (int i = 0; i < _target.Length; i++) { Transform _targetTf = _target[i].transform; if (_targetTf.name == "Character") { Vector3 _direction = (_targetTf.position - transform.position).normalized; float _angle = Vector3.Angle(_direction, transform.forward); if(_angle < viewAngle * 0.5f) { if (Physics.Raycast(transform.position + transform.up + transform.forward, _direction, out RaycastHit _hit, viewDistance)) { Debug.Log(_hit); if (_hit.transform.name == "Character") { Debug.Log("플레이어가 소 시야내에 있습니다."); Debug.DrawRay(transform.position + transform.up + transform.forward, _direction, Color.blue); return true; } } } } if (thePlayer.GetRun()) { if(CalcPathLength(thePlayer.transform.position) <= viewDistance) { Debug.Log("동물이 주변에서 뛰고있는 플레이어의 움직임을 파악했습니다."); return true; } } } return false; } private float CalcPathLength(Vector3 _targetPos) { NavMeshPath _path = new NavMeshPath(); nav.CalculatePath(_targetPos, _path); Vector3[] _wayPoint = new Vector3[_path.corners.Length + 2]; _wayPoint[0] = transform.position; _wayPoint[_path.corners.Length + 1] = _targetPos; float _pathLength = 0; for (int i = 0; i < _path.corners.Length; i++) { _wayPoint[i + 1] = _path.corners[i]; // 웨이포인트에 경로를 넣음. _pathLength += Vector3.Distance(_wayPoint[i], _wayPoint[i + 1]); // 경로 길이 계산. } return _pathLength; } }
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
크로스헤어 문제
크로스헤어를 하고 있는데 못 해결하고 있는 문제가 있습니다. 걷고 있으면 애니메이터에서 crosshair_idle 이랑 crosshair_walk를 계속해서 왔다갔다해요. 제가 한 부분까지 다 돌려서 봤는데 문제는 없는 것 같았어 요. 전체코드:(Playercontroller) using UnityEngine; using System.Collections; using System.Collections.Generic; public class PlayerController : MonoBehaviour { //스피드 조정 변수 [SerializeField] private float walkSpeed; [SerializeField] private float runSpeed; [SerializeField] private float crouchSpeed; private float applySpeed; [SerializeField] private float jumpForce; //상태 변수 private bool isWalk = false; private bool isRun = false; private bool isCrouch = false; private bool isGround = true; //움직임 체크 변수 private Vector3 lastPos; //앉았을 때 얼마나 앉을지 결정하는 변수 [SerializeField] private float crouchPosY; private float originPosY; private float applyCrouchPosY; //땅 착지 여부 private CapsuleCollider capsuleCollider; // 민감도 [SerializeField] private float lookSensitivity; // 카메라 한계 [SerializeField] private float cameraRotationLimit; private float crrentCameraRotationX = 0; //필요한 컴포넌트 [SerializeField] private Camera theCamera; private Rigidbody myRigid; private GunController theGunController; private crosshair thecrosshair; // Start is called before the first frame update void Start() { capsuleCollider = GetComponent<CapsuleCollider>(); myRigid = GetComponent<Rigidbody>(); theGunController = FindObjectOfType<GunController>(); thecrosshair = FindObjectOfType<crosshair>(); applySpeed = walkSpeed; originPosY = theCamera.transform.localPosition.y; applyCrouchPosY = originPosY; } // Update is called once per frame void Update() { IsGround(); TryJump(); TryRun(); TryCrouch(); Move(); Movecheck(); cameraRotation(); CharacterRotation(); } private void TryCrouch() { if(Input.GetKeyDown(KeyCode.LeftControl)) { Crouch(); } } private void Crouch() { isCrouch = !isCrouch; thecrosshair.crouchingAnimation(isCrouch); if(isCrouch) { applySpeed = crouchSpeed; applyCrouchPosY = crouchPosY; } else { applySpeed = walkSpeed; applyCrouchPosY = originPosY; } StartCoroutine(CrouchCoroutine()); } IEnumerator CrouchCoroutine() { float _posY = theCamera.transform.localPosition.y; int count = 0; while(_posY != applyCrouchPosY) { count++; _posY = Mathf.Lerp(_posY, applyCrouchPosY, 0.3f); theCamera.transform.localPosition = new Vector3(0, _posY, 0); if(count > 15) break; yield return null; } theCamera.transform.localPosition = new Vector3(0, applyCrouchPosY, 0f); } private void IsGround() { isGround = Physics.Raycast(transform.position, Vector3.down, capsuleCollider.bounds.extents.y + 0.1f); } private void TryJump() { if(Input.GetKeyDown(KeyCode.Space) && isGround) { jump(); } } private void jump() { if(isCrouch) Crouch(); myRigid.velocity = transform.up * jumpForce; } private void TryRun() { if(Input.GetKey(KeyCode.LeftShift)) { Running(); } if(Input.GetKeyUp(KeyCode.LeftShift)) { RunningCancel(); } } private void Running() { if(isCrouch) Crouch(); theGunController.CancelFineSight(); isRun = true; thecrosshair.runningAnimation(isRun); applySpeed = runSpeed; } private void RunningCancel() { isRun = false; thecrosshair.runningAnimation(isRun); applySpeed = walkSpeed; } private void Move() { float _MoveDirX = Input.GetAxisRaw("Horizontal"); float _MoveDirZ = Input.GetAxisRaw("Vertical"); Vector3 _moveHorizontal = transform.right * _MoveDirX; Vector3 _moveVertical = transform.forward * _MoveDirZ; Vector3 _velocity = (_moveHorizontal + _moveVertical).normalized * applySpeed; myRigid.MovePosition(transform.position + _velocity * Time.deltaTime); } private void Movecheck() { if(!isRun && !isCrouch) { if(Vector3.Distance(lastPos, transform.position) >= 0.01f) isWalk = true; else isWalk = false; thecrosshair.walkingAnimation(isWalk); Vector3 position = transform.position; lastPos = position; } } private void CharacterRotation() { float _yRotation = Input.GetAxisRaw("Mouse X"); Vector3 _characterRotationY = new Vector3(0f, _yRotation, 0f) * lookSensitivity; myRigid.MoveRotation(myRigid.rotation * Quaternion.Euler(_characterRotationY)); } private void cameraRotation() { float _xRotation = Input.GetAxisRaw("Mouse Y"); float _cameraRotationX = _xRotation * lookSensitivity; crrentCameraRotationX -= _cameraRotationX; crrentCameraRotationX = Mathf.Clamp(crrentCameraRotationX, -cameraRotationLimit, cameraRotationLimit); theCamera.transform.localEulerAngles = new Vector3(crrentCameraRotationX, 0f, 0f); } }
- 미해결[유니티 3D] 실전! 생존게임 만들기 - Advanced
재장전을 하고나면 정조준 값은 똑같은데 위치가 바꿔저요
전체 코드: using System.Collections; using System.Collections.Generic; using UnityEngine; public class GunController : MonoBehaviour { [SerializeField] private Gun currentGun; private float currentFireRate; private bool isReload = false; private bool isFineSightMode = false; [SerializeField] private Vector3 originPos; private AudioSource audioSource; void Start() { audioSource = GetComponent<AudioSource>(); } // Update is called once per frame void Update() { GunFireRateCalc(); TryFire(); TryReload(); TryFineSight(); } private void GunFireRateCalc() { if(currentFireRate > 0) currentFireRate -= Time.deltaTime; } private void TryFire() { if (Input.GetButton("Fire1") && currentFireRate <= 0 && !isReload) { Fire(); } } private void Fire() { if(!isReload) { if(currentGun.currentBulletCount > 0) Shoot(); else StartCoroutine(ReloadCoroutine()); } } private void Shoot() { currentGun.currentBulletCount--; currentFireRate = currentGun.fireRate; PlaySE(currentGun.fire_Sound); currentGun.muzzleFlash.Play(); Debug.Log("총알 발사함"); } private void TryReload() { if(Input.GetKeyDown(KeyCode.R) && !isReload && currentGun.currentBulletCount < currentGun.reloadBulletCount) { StartCoroutine(ReloadCoroutine()); } } IEnumerator ReloadCoroutine() { if(currentGun.carryBulletCount > 0) { isReload = true; currentGun.anim.SetTrigger("reload"); currentGun.carryBulletCount += currentGun.currentBulletCount; currentGun.currentBulletCount = 0; yield return new WaitForSeconds(currentGun.reloadTime); if(currentGun.carryBulletCount >= currentGun.reloadBulletCount) { currentGun.currentBulletCount = currentGun.reloadBulletCount; currentGun.carryBulletCount -= currentGun.reloadBulletCount; } else { currentGun.currentBulletCount = currentGun.carryBulletCount; currentGun.carryBulletCount = 0; } isReload = false; } else { Debug.Log("소유한 총알이 없습니다."); } } private void TryFineSight() { if(Input.GetButtonDown("Fire2")) { FineSight(); } } private void FineSight() { isFineSightMode = !isFineSightMode; currentGun.anim.SetBool("FineSightMode", isFineSightMode); if(isFineSightMode) { StopAllCoroutines(); StartCoroutine(fineSightActivateCoroutine()); } else { StopAllCoroutines(); StartCoroutine(fineSightDeactivateCoroutine()); } } IEnumerator fineSightActivateCoroutine() { while(currentGun.transform.localPosition != currentGun.fineSightOriginPos) { currentGun.transform.localPosition = Vector3.Lerp(currentGun.transform.localPosition, currentGun.fineSightOriginPos, 0.2f); yield return null; } } IEnumerator fineSightDeactivateCoroutine() { while(currentGun.transform.localPosition != originPos) { currentGun.transform.localPosition = Vector3.Lerp(currentGun.transform.localPosition, originPos, 0.2f); yield return null; } } private void PlaySE(AudioClip _clip) { audioSource.clip = _clip; audioSource.Play(); } }