2019年3月26日 星期二

Week06_05160664

Week06
1.了解我們所打的程式碼的部分,先下載VSCODE
2.開啟unity並寫程式碼,先選Edit=>Preferences=>External Tools=>External Script Editor=>設定成VSCODE
3.安裝TreeSize Free,TreeSize可以看匯入Unity的資源大小
4.手把位置出球程式碼
5.手把出球程式碼
6.成果:一堆球

week06 紘希

使用TreeSize看匯入Unity的大小

Steam VR 可自行安裝需要的部分


VR Real Week06





vr比賽在銘傳S405

講解期末作品細節
  1)如何企劃期中作品企劃&準備期末作品實作
  2)期末作品展示/評分/競賽
  3)
看去年的VR battle作品影片
  4)
介紹作品如何逐步做出來


學長ppt學習
  1)steam VR Plugin 僅放入需要的檔案
  2)steam VR input 記得存檔
  3)Grabpinch(扣動扳機)
  4)程式碼如何運作的
  5)生成需要的模型(食指按下)

上課操作步驟
  1)vive硬體/軟體更新(steam VR update) 要更新才能用
  2)unity 2018開啟,Asset; Steam VR
  3)TODO:做小畫家



學長程式碼(以此作修改)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Value.VR;

public class ViveInput : MonoBehaviour {

       public Steam_Action_Boolean triggerDown;
       public Steam_Action_Vibration hapticAction;
       public Steam_Action_Single squeezeAction;
       public Steam_Action_Vector2 touchpadTouch;

      void Update(){

             if (triggerDown.GetState(SteamVR_Input_Sources.Any))
             {
                 hapticAction.Execute(0, 1, 150, 75, SteamVR_Input_Sources.LeftHand);
                 print("triggerDown");
             }

             float triggerValue = squeezeAction.GetAxis (SteamVR_Input_Sources.Any);
             Vector2 padPods = touchpadTouch.GetAxis (SteamVR_Input_Sources.Any);
    
             if (triggerValue > 0.0f)
            {
                 print("");
            }

week06 Jie

根據手把位置產生物件

1.結果如下


2.程式碼如下
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;

public class controller_ball : MonoBehaviour
{
    // Start is called before the first frame update
    public SteamVR_Action_Boolean triggerDown;//宣告Trigger所需的布林變數
    public GameObject ball;//宣告生成球體用的變數
    public GameObject controller_pos;//宣告記錄手把位址的變數
    bool state=false;
  
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)
            {
                state=true;

                print("triggerDown");

                GameObject now=Instantiate(ball);//生成球體
                now.transform.position=controller_pos.transform.position;//將手把位址給予球體
            }
        }
        else
        {
            state=false;
        }
    }    
}

黃惠嘉05160080_VR_Week06

1.import steamVR


2.改成VScode

3.新增Cude

4.程式碼


5.套在Light上

Week6_沈哲民

了解VR手把程式

using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; public class vive : MonoBehaviour { public SteamVR_Action_Boolean triggerDown;//宣告triggerDown public SteamVR_Action_Vibration hapticAction; public SteamVR_Action_Single squeezeAction; public SteamVR_Action_Vector2 touchpadTouch;
float x=0;
bool state=false;
public GameObject myPhere; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if(triggerDown.GetState(SteamVR_Input_Sources.Any))//偵測手把的狀態 { if(state==false){

  state=true;
print("yes");
GameObject now=Instantiate(mySphere);產生object
now.transform.position = new Vector3(x,0,0);產生的位置
x++;
} }

week06


按下TRIGGER會print"YES"


跑出物件,在同一方向X軸


可以隨著手把位置,按下TRIGGER產生1物件

逸臻的筆記Week06-3D小畫家

-3D小畫家 -

1. Unity、Steam VR、Vive、VS Code 設定

2.設定Trigger Down

3.按下手把出現物件

4.由手把座標位置決定物件位置

程式碼:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;

public class MyScript : MonoBehaviour
{
    public SteamVR_Action_Boolean triggerDown;
    // Start is called before the first frame update
    public GameObject mysphere;
    public GameObject myController;
    bool state=false;
    
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)
            {
                state=true;

                print("triggerDown");

            GameObject now=Instantiate(mysphere);
            //now.transform.position = new Vector3(x,0,0);
            //x++;
            now.transform.position=myController.transform.position;
            }
        }
        else
        {
            state=false;
        }
    }      
}

8ㄍ VR實境課週記 Week06

Week 06

Step 01 編譯器環域更新


Step 02 封包確認認識


Step 03 觸擊把手按鍵產生文字

Step 04觸擊把手按鍵產生球(這時是一按就產生一堆)















Step 05觸擊把手按鍵產生球(按一次產生一個)

Step 06 觸擊把手按鍵產生球(跟著把手生成)


code:


public SteamVR_Action_Boolean triggerDown;
    // Start is called before the first frame update
    public GameObject mysphere;  ///物件
    public GameObject myController;///把手座標
    bool state=false;
    
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)///確認觸擊
            {
                state=true;

                print("triggerDown");///按下去產生文字資訊

            GameObject now=Instantiate(mysphere);///按下產生
            //now.transform.position = new Vector3(x,y,0);///定點產生的
            //x++;
            now.transform.position=myController.transform.position;///跟隨把手座標
            }
        }
        else
        {
            state=false;
        }
    }      

Week06 +1 notes

手把變出球



X++;



X++; Y++;


球隨手把出現


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;

public class MyScript : MonoBehaviour
{
    public SteamVR_Action_Boolean triggerDown;
    // Start is called before the first frame update
    public GameObject mysphere; //宣告了一個名叫mysphere的變數,它的形態是GameObject
    public GameObject myController;
    bool state=false; //state是否有按
 
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)
            {
                state=true;

                print("triggerDown");

            GameObject now=Instantiate(mysphere);
            //now.transform.position = new Vector3(x,0,0); //物件位置為座標點(x,0,0)
            //x++;
            now.transform.position=myController.transform.position;
            }
        }
        else
        {
            state=false;
        }
    }   
}


week06矮矮的筆記

1.在unity中加入一個sphere並拉到assets中
    新增一個程式
    一樣到steamVR的資料夾->prefabs->把camera rig 移到hierarchy
2.程式碼的部分

3.第一次嘗試
   按下手把物件都在原地產生
4.修改一些程式碼
5.再試一次
   不會重疊了~~

Week06_ㄩㄐ的快樂早晨

Week 06 重點:

① 企劃其中作品的方法&展示/評分/競賽

② 製作預製物:
預製物製作完成&控制數量

額外目標:理解 Vive 基地台兩種連線

① 企劃其中作品的方法&展示/評分/競賽

▶ 參考 VR Battle的作品影片



 參考已畢業學長的作品(上課呈現)

② 製作預製物
 回顧上週,按下 trigger 則回饋 YES

 透過 trigger 與程式連結

↑ 寫完程式套入主光


額外目標:

Week06

2019-03-26
Week06


今天要看懂程式



用TreeSize 可以看匯入Unity的資源大小


手把位置出球:



手把出球:




成果:





Week06 呆江

Week06 手把控制

建立Unity專案後,在場景中建立3D object(本次使用Sphere)
建立完畢後拉到 Assets中,就會變成 Prefab(名字會變藍色)



程式碼:


結果:




week6-老師! 柏穎一直鬧

1.一位優秀的碼農需要的工具:7z、Nopad++、 TreeSize Free

2.安裝所需工具visual studio code & .NET core ...

3.開啟Unity & 安裝SteamVR plugin

4.Key程式碼
固定地點出現球的程式碼:


從手把的地方出現球的程式碼


成果:

手把移動按trigger會出現球 一直按移動之後就像腸子一樣 有點噁心....