VR 테마파크 프로젝트 스터디 (4기 부산/경남)

참여인원 : 50명

모임일정 : 2017년 3월 25일 ~ 8개월 (월 2회, 토요일 오후 2시~5시, 3시간, 간혹 운영자 개인 사정으로 일요일 및 시간 변경될 수 있음)

모임장소 : 아지트가 없는 관계로 수시로 변경 ㅡㅡ;

스터디 : VR SDK(이경용), 유니티5 (정현철), 언리얼 (정현철), 아두이노 및 센서개발 (이상협), 블렌드 3D (조현퇴), 3D프린트 (조현퇴)

프로젝트 : 실내 공간에서 여러명이서 고스트를 잡는 콘텐츠 개발, VR과 연동하는 하드웨어 장치, 실내에서 유저의 위치 파악하는 센스 등 개발, AR 스마트 팽이

준비물 : 노트북, 유니티5 설치 (아두이노 외 센서 부품 등)

모임문의 : 이경용 010-2694-8424 / ceo@apptools.co.kr

부운영자 및 멘토 :  정현철, 이상협, 박대웅, 조현퇴

4기 부산/경남

[VR검투사] 7일차

페이지 정보

작성자 손호준 작성일17-06-27 18:49 조회1,747회 댓글0건

첨부파일

본문

-손호준-

 

어제하던 고양이 게임을 마저 구현 했습니다.

총알끼리 부딪쳐서 위로 날라가는 현상을 막기위해 emptyObject를 하나 생성하여 IsTrigger를 설정한다음 총알이 닿이면 사라지게 만들었고

private void OnTriggerEnter(Collider coll)

    {

        if (coll.tag == "Bullet" || coll.tag == "RedBullet")

        {

            Destroy(coll.gameObject);

        }

    }

Hp 와 기록 Time을 만들어서 UI화면에 띄우고 HP가 0이 되는순간 GameOver 장면이 뜨게 만들었으며

GameOver 상태에서 Y를 누를시 다시 시작하도록 만들었습니다.

void Update () {

        if (gameOver && Input.GetKeyDown(KeyCode.Y))

        {

            Application.LoadLevel(Application.loadedLevel);

            PlayerCtr.hp = 10;

        }

    }

그리고 하늘에서 폭탄들이 랜덤한 위치에서 내려와 땅에 닿이면 5초간 기다리게 하고 난 후 터지게 만들었습니다.

private void OnTriggerEnter(Collider other)

    {

        if(other.tag == "Ground")

        {

            StartCoroutine("Explosion", count);

        }

    }

 

    IEnumerator Explosion(float count)

    {

        yield return new WaitForSeconds(count);

        Debug.Log("Explosion");

        Collider[] colls = Physics.OverlapSphere(transform.position, 10f);

        foreach(Collider coll in colls)

        {

            Rigidbody rbody = coll.GetComponent<Rigidbody>();

            if(rbody != null)

            {

                rbody.mass = 1f;

                rbody.AddExplosionForce(1000f, tr.position, 10f, 300f);

            }

        }

        Destroy(this.gameObject);

    }

폭탄 생성 위치를 만들어 랜덤하게 이동하게 만들었습니다.

IEnumerator BombCreat(float delay)

    {

        yield return new WaitForSeconds(delay);

        v3.x = Random.Range(-49f, 49f);

        v3.y = 10f;

        v3.z = Random.Range(-49f, 49f);

        rigidbody.MovePosition(v3);

        Instantiate(bomb, tr.position, tr.rotation);

        StartCoroutine("BombCreat", delay);

    }

 

-이성현 조충진-

오늘은 아두이노 모듈들을 만져보았습니다 서보모터를 포함해 터치모듈, 온도감지모듈, 진동모듈 을 만져보았고

내일은 더많은 모듈들을 만져볼 예정입니다

#include<Servo.h> //Servo 라이브러리를 추가

Servo servo;      //Servo 클래스로 servo객체 생성

int value = 0;    // 각도를 조절할 변수 value

 

void setup() {

  servo.attach(7);     //맴버함수인 attach : 핀 설정

  Serial.begin(9600); //시리얼 모니터 사용 고고

}

 

void loop() {

  if(Serial.available())      //시리얼 모니터에 데이터가 입력되면

  {

    char in_data;             // 입력된 데이터를 담을 변수 in_data

    in_data = Serial.read(); //시리얼모니터로 입력된 데이터 in_data로 저장

    if(in_data == '1')        //입력된 데이터가 1이라면

    {

      value += 30;            //각도를 30도 증가시킨다.

      if(value == 210)        //각도가 210도가 되면 (180도보다 커지면)

        value = 0;            //각도를 0으로 초기화

    }

    else                      //그외의 데이터가 입력되면

      value = 0;              //각도를 0으로 초기화

      

    servo.write(value); //value값의 각도로 회전. ex) value가 90이라면 90도 회전

  }

}

 

동영상 첨부합니다

-서정호-

 

​오늘은 배럴의 폭발과 랜덤한 위치에 떨어지게 하였고 캐릭터의 총발포와 총궤적을 나타내었고 배경맵을 설정하였습니다 아직 미흡한점이많고 배럴위치를 나타낼때에는 구글링을 하기엔 너무 모르는것이 많아 옆에서 조언을 받았고 다음에할땐 배럴뿐만아니라 다른 컨텐츠 제작도 해야겟다고 생각하였습니다 


-성기헌-

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.AI;

[RequireComponent (typeof (NavMeshAgent))]


public class Enemy : LivingEntity

{

    public enum State { Idle, Chasing, Attacking};

    State currentState;


    NavMeshAgent pathfinder;

    Transform target;

    LivingEntity targetEntity;

    Material skinMaterial;


    Color originalColour;


    float attackDistanceThreshold = .5f;

    float timeBetweenAttacks = 1;

    float damage = 1;


    float nextAttackTime;

    float myCollisionRadius;

    float targetCollisionRadius;

    bool hasTarget;



    protected override void Start()

    {

        base.Start();

        pathfinder = GetComponent<NavMeshAgent>();

        skinMaterial = GetComponent<Renderer>().material;

        originalColour = skinMaterial.color;


        if (GameObject.FindGameObjectWithTag("Player") != null)

        {


            currentState = State.Chasing;

            hasTarget = true;


            target = GameObject.FindGameObjectWithTag("Player").transform;

            targetEntity = target.GetComponent<LivingEntity>();

            targetEntity.OnDeath += OnTargetDeath;


            myCollisionRadius = GetComponent<CapsuleCollider>().radius;

            targetCollisionRadius = target.GetComponent<CapsuleCollider>().radius;

            StartCoroutine(UpdatePath());

        }

    }

    void OnTargetDeath()

    {

        hasTarget = false;

        currentState = State.Idle;

    }

   

   

   void Update () {

        if(hasTarget) {

            if (Time.time > nextAttackTime)

            {

                float sqrDstToTarget = (target.position - transform.position).sqrMagnitude;

                if (sqrDstToTarget < Mathf.Pow(attackDistanceThreshold + myCollisionRadius + targetCollisionRadius, 2))

                {

                    nextAttackTime = Time.time + timeBetweenAttacks;

                    StartCoroutine(Attack());


                }

            }

   }}


    IEnumerator Attack()

    {

        currentState = State.Attacking;

        pathfinder.enabled = false;


        Vector3 originalPosition = transform.position;

        Vector3 dirToTarget = (target.position - transform.position).normalized;

        Vector3 attackPosition = target.position - dirToTarget * (myCollisionRadius);

        

        


        float attackSpeed = 3;

        float percent = 0;


        skinMaterial.color = Color.red;

        bool hasAppliedDamage = false;


        while (percent <= 1)

        {


            if(percent >= .5f && !hasAppliedDamage)

            {

                hasAppliedDamage = true;

                targetEntity.TakeDamage(damage);

            }


            percent += Time.deltaTime * attackSpeed;

            float interpolation = (-Mathf.Pow(percent, 2) + percent) * 4;

            transform.position = Vector3.Lerp(originalPosition, attackPosition, interpolation);

            yield return null;

        }

        skinMaterial.color = originalColour;

        currentState = State.Chasing;

        pathfinder.enabled = true;

    }



    IEnumerator UpdatePath()

    {

        float refreshRate = .25f;

        while (hasTarget)

        {

            if (currentState == State.Chasing)

            {

                Vector3 dirToTarget = (target.position - transform.position).normalized;

                Vector3 targetPosition = target.position - dirToTarget * (myCollisionRadius + targetCollisionRadius + attackDistanceThreshold/2);

                if (!dead)

                {

                    pathfinder.SetDestination(targetPosition);

                }

            }

            yield return new WaitForSeconds(refreshRate);

        }

    }

}


몬스터 생성 및 추적기능을 넣고 데미지를 입으면 삭제되는방식으로 스크립트를 작성하였습니다.

그리고 몬스터에 공격모션을 넣어 좀더 구체적인 공격모션을 볼수있게 설정했고 사용자가 피격시

HP가 줄어들어 죽는것까지 구현하였으며 다음 스테이지로 넘어갈때 몬스터가 자동으로 생성되도록 

구현하였습니다.


  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기

* 글을 등록하실때 꼭 필요한 경우가 아니면 개인정보를 남기지 마세요 ^^ (연락처,이메일주소,주민등록번호 등)





  최면중... 당신은 곧 코멘트를 달게 됩니다...수리수리 뽀로롱..

댓글목록

등록된 댓글이 없습니다.

4기 부산/경남 목록

Total 38건 1 페이지
4기 부산/경남 목록
번호 제목 글쓴이 날짜 조회
38 [VR검투사]18일차 인기글 손호준 07-12 2225
37 [VR검투사]17일차 인기글첨부파일 손호준 07-11 2260
36 [VR 검투사] 16일차 인기글 손호준 07-10 2308
35 [VR검투사] 15일차 인기글첨부파일 손호준 07-07 2258
34 [VR검투사] 14일 차 인기글첨부파일 손호준 07-06 2324
33 [VR검투사] 13일차 인기글첨부파일 손호준 07-05 2652
32 [VR검투사] 12일차 인기글첨부파일 손호준 07-04 2047
31 [VR검투사]11일차 인기글첨부파일 손호준 07-03 1976
30 [VR검투사]10일차 인기글첨부파일 손호준 06-30 1799
29 [스마트팽이]10일차 인기글 모진원 06-30 1724
28 [VR검투사]9일차 인기글첨부파일 손호준 06-29 2105
27 [스마트팽이]9일차 인기글첨부파일 모진원 06-29 1704
26 [VR검투사]8일차 인기글첨부파일 손호준 06-28 2004
25 [스마트팽이]8일차 인기글 이정목 06-28 1705
열람중 [VR검투사] 7일차 인기글첨부파일 손호준 06-27 1748
23 [VR검투사] 6일차 인기글첨부파일 손호준 06-26 1688
22 [VR검투사] Unity학습5 인기글 조충진 06-23 1684
21 [스마트팽이팀]5일차 인기글첨부파일 모진원 06-23 1772
20 [VR검투사] Unity 학습4 인기글 성기헌 06-22 1884
19 [스마트 팽이]4일차 인기글첨부파일 모진원 06-22 1793
게시물 검색
모바일 버전으로 보기