마블 VR 프로젝트 제작29 적 방향으로 방패 날라가기 지금까지는 눈의 앞 방향으로 날라가도록 하고 적의 collider를 크게 만들었다. 하지만 대충 방향이 맞으면 적의 방향으로 정확하게 날아가도록 만들어야한다. main에서 플레이어로부터 일정 거리 이하의 적을 감지하고 public GameObject FindEnemyDir() { Collider[] enemyCols = Physics.OverlapSphere(this.playerTrans.position, detectEnemyRadius, 1 0) { Debug.Log(mainDic.Count); var nearestDir = this.mainDic.Values.Max();//가장 방향이 비슷한 적 var target = this.mainDic.FirstOrDefault(x => x.Value == ne.. 2024. 1. 9. 버그 수정 1. leap 했을 때 방향 및 넘어갔을때 캐릭터 선택 ui 위치 this.transform.localRotation = Quaternion.Euler(-0.004f, 89.645f, -0.106f); 다행히 캐릭터 선택 canvas 가 눈의 앞쪽에서 생성된다. 2. 방패 지상적 3개 이상 맞추는거 private GameObject FindNextTarget() { Collider[] enemyCols = Physics.OverlapSphere(this.pos.transform.position, this.detectRadius, 1 0&&targetnum x.Value == nearestDistance).Key; this.targetnum += 1; Debug.Log("타겟이 3개 이하다."); retu.. 2024. 1. 8. [마블 VR] 게임 클리어하면 다음 스테이지 오픈 캐릭터 선택 UI에서 처음에는 캡틴 아메리카가 가운데 버튼이어야하지만 캡틴 아메리카를 클리어 -> 아이언맨 버튼이 가운데로 와야한다. normalizedPosition을 바꿔야한다. public class SelectCharaterMain : MonoBehaviour { public bool isClearCaptain = false; void Start() { if (this.isClearCaptain==false) { this.scrollRect.normalizedPosition = new Vector2(0.4f, 0); this.num = 4; this.normalizedPositionX = 0.4f; } else//클리어하고 왔으면 { this.scrollRect.normalizedPosition .. 2024. 1. 3. [마블 VR] 스페이스 스톤 잡으면 씬전환 1. 컨트롤러로 스페이스 스톤 잡기 왼손은 방패를 잡고 있으므로 오른손으로 잡도록 한다. 우리는 컨트롤러로 하는거니까 right에 controllerGrabInteractor을 추가한다. controllerInteractors에 BestHoverInteractorGroup의 Interactors에 ControllerGrabInteractor를 끌어다가 넣는다. 잡힐 물체에 boxcollider(is Trigger 체크), RigidBody(useGravity 언체크), Grabble, Grab Interactable 을 추가한다. 2. 잡으면 '씬전환' 로그 찍기 event wrapper 사용 pointable unity Event wrapper 추가 내가 만든 스크립트 추가 using System.Co.. 2024. 1. 2. [마블 VR] 플레이어 HP 감소하기 레이가 처음 맞은애만 감지해야하는데 관통하면 안되기 때문에 어떻게 구현해야할까 고민하면서 찾아보는중에 레이는 맨 처음 충돌이 일어난 직후인 딱 1번만 반응을 하고 그 다음은 반응을 하지 않는다, 관통하지 못한다라는 말이 쓰여진 블로그를 찾았다. 충돌한 물체는 모두 찾으려면 RaycastAll을 사용해야한다고 적혀있었다. 참고한 블로그 https://velog.io/@romance_mh/Unity3D-Raycast-7 [Unity3D] Raycast #7 if (Physics.Raycast(transform.position, transform.forward, out hit, MaxDistance))(Ray 원점, Ray 방향, 충돌 감지할 RaycastHit, Ray 거리(길이))ay 거리(길이)를 넣지 .. 2024. 1. 2. [마블 VR] 근접 공격 튜토리얼 완료 -> 적 생성 1. 간단하게 trigger버튼을 눌렀다가 떼면 튜토리얼이 완료되도록 구현되어 있는 스크립트 ==> 실제로 trigger 버튼을 누르고 위에서 아래로 찍으면 완료되도록 수정하기 IEnumerator CoGrab() { while (true) { if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch)) { Debug.Log("step1완료"); this.step1High.gameObject.SetActive(false); this.setp1.SetActive(true); this.step2High.gameObject.SetActive(true); this.setp2.SetActive(false); } if (.. 2023. 12. 29. 이전 1 2 3 4 5 다음