顯示具有 week14 標籤的文章。 顯示所有文章
顯示具有 week14 標籤的文章。 顯示所有文章

2019年6月29日 星期六

week14

1.我們決定先解決物理方面的問題,之後再解決長得不向的問題,先求有再求好。

2.現在有球有線,我們想要讓他可以一直生成,所以利用instantiate()這個函式,不斷呼叫prefab,這樣可以產生出很多球跟線,模擬棉花糖機噴絲的感覺。

紹軒的糖絲日記-week14

這週我們將糖絲的sphere可以黏到我們設定的一個板子上了


但仍然無法將他長大!!

2019年6月24日 星期一

2019年6月16日 星期日

Week14 昱霖的筆記

加入射擊程式碼,
左、右槍皆可射擊
(在槍口放一個empty作為射擊點,放入此程式碼)
調整子彈速度與方向
令子彈在定值後消失

2019年6月4日 星期二

Week14

Week14.

模型都做完了

這一天請假了沒有來上課
在FB群組和組員報告和討論進度

2019年5月21日 星期二

逸臻的筆記Week14-期末作品進度#5

-期末作品進度#5-

分開碰撞物件 ( 把一個物件套一個程式 )

球1程式碼:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom : MonoBehaviour
{
    GameObject realBoard=null;
    public GameObject board;
    public GameObject BAT; //BAT手把
    // Start is called before the first frame update
    void Start()
    {
    
    }

    // Update is called once per frame
    float x=0;
    void Update()
    {
  

    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision");
        if(realBoard==null)  realBoard = Instantiate(board); //碰撞後秀出文字板
    }
}


球2程式碼:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
      
    }

    // Update is called once per frame
    void Update()
    {
      
    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision22222");
    }  
}


Week14 矮矮的筆記

音樂對拍
嘗試寫第二次
修改蠻久的
最後決定上網查其他方式
因為覺得這個寫法不可行
陣列的部分
因為音樂的拍子不一定剛好是在幾分幾秒
所以必須解決這個問題

week14 Jie

旋轉物件(四)

完成後跟老師討論,發現按壓旋轉的方式非常不方便,於是更改為滑動方式並加入過關條件
1.更改程式碼如下
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

[RequireComponent(typeof(SteamVR_TrackedObject))]
public class ControllerTest : MonoBehaviour {
SteamVR_TrackedObject trackedObj;
SteamVR_Controller.Device device,deviceLeft,deviceRight;
public GameObject obj;
float a=0.0f,b=0.0f,c=0.0f;
Vector2 rotat=new Vector2(0.0f,0.0f);
public static bool over=false;
void Start () {
trackedObj=GetComponent<SteamVR_TrackedObject>();
a=obj.transform.rotation.x;
b=obj.transform.rotation.y;
c=obj.transform.rotation.z;
}

// Update is called once per frame
Vector2 tp2;
bool bTouched=false;
void Update () {
device = SteamVR_Controller.Input ((int)trackedObj.index);
var leftHand = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Leftmost);
deviceLeft = SteamVR_Controller.Input (leftHand);
var rightHand = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Rightmost);
deviceRight = SteamVR_Controller.Input (rightHand);
Vector2 tp=Vector2.zero,tp1=Vector2.zero;
if (device.GetTouch (SteamVR_Controller.ButtonMask.Touchpad)){
                //由原先的GetPress更改為GetTouch
tp2 = tp1;//備份第一次碰到的位置
tp1 = device.GetAxis ();//備份完後再讀取Touchpad碰到的位置

if(bTouched){
rotat=tp1-tp2;
//print("tp1:"+tp1+"\n");
//print("tp2:"+tp2);
//print("diff:"+ (tp1-tp2));
///....
float angle=Vector2.Angle (new Vector2 (1, 0), rotat);
if (angle > 45 && angle < 135) {
if (rotat.y > 0){
a+=3.0f;
if(a>180.0f)
a%=180.0f;
}
else{
a-=3.0f;
if(a<-180.0f)
a%=180.0f;
}
}
else {
if (rotat.x>0){
b+=3.0f;
if(b>180.0f)
b%=180.0f;
}
else{
b-=3.0f;
if(b<-180.0f)
b%=180.0f;
}
}
}
bTouched=true;
}
else
bTouched=false;

obj.transform.rotation = Quaternion.Euler (new Vector3 (a, b, c));

if((a<=-5.0f && a>=-25.0f) && (b<=80.0f && b>=60.0f)){
                //若物件達到指定角度
                        over=true;
SceneManager.LoadScene ("start_menu");
}

}
}

2.過關條件判斷
因為我們程式的寫法是一直累加或減角度,導致最後數值會大於或小於360度,所以在做條件判斷時需將數值除以180取餘數,以取得正確的數值
if (angle > 45 && angle < 135) {
if (rotat.y > 0){
a+=3.0f;
if(a>180.0f)
a%=180.0f;
}
else{
a-=3.0f;
if(a<-180.0f)
a%=180.0f;
}
}
else {
if (rotat.x>0){
b+=3.0f;
if(b>180.0f)
b%=180.0f;
}
else{
b-=3.0f;
if(b<-180.0f)
b%=180.0f;
}
}


week14_焦焦焦

老師為我們加課:

用我之前修課的作業(Processing)來喚醒對Unity的印象,以Processing程式語法轉換成Unity的方式呈現

從Processing秀出圖檔


從Unity秀出圖檔


在Processing秀出一顆會移動的球轉換成Unity方式呈現


Week14 +1 notes

分開碰撞物件(把一個物件套一個程式) \文字版面






第一顆球 程式
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom : MonoBehaviour
{
    GameObject realBoard=null;
    public GameObject board;
    public GameObject BAT; //BAT手把
    // Start is called before the first frame update
    void Start()
    {
   
    }

    // Update is called once per frame
    float x=0;
    void Update()
    {
 

    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision");
        if(realBoard==null)  realBoard = Instantiate(board); //碰撞後秀出文字板
    }
}




第二顆球 程式
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
     
    }

    // Update is called once per frame
    void Update()
    {
     
    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision22222");
    } 
}



Week14_ㄩㄐ的快樂燒聲

Week 15 目標

① 更新期末作品進度

① 更新期末作品進度

▶ 校正子彈發射



開始在各方尋找能用的資源 
後來將第三個網站的 transform.rotation = Quaternion.Euler(new Vector3(0f,90f,0f));
作為子彈的方向
▶ 場景微調


↑ 一些場景畫面和偵測回饋

WEEK14 QAQ筆記

垃圾桶程式碼

不要的食材丟入桶子中碰撞到觸發器就消失

(將食材及飲料的layer設高於1,只要layer高於1的物件碰到觸發器及消失)


Week14 安淇的筆記

加入射擊程式碼,讓左、右槍都可以射擊

WEEK14

程式研究轉場

week14

今天一樣是建場景的模型

Week14_黃登煜

1.一樣是場景模型製作

week14

Camera rig

1. 調整場景大小、位置

雷射

1. 設定把手,按下Trigger會發出射線,要把物體加上collider

2. 放開Trigger射線會消失

竹籤設定

Rigidbody →Is Kinematic打勾




















爐子設定

Rigidbody → Use Gravity打勾 → Is Kinematic打勾















使得竹籤不會穿越爐子

Week 14 葉政翰



  1. 程式須優化
  2. 如果需要樹枝當作素材,需要重新製作及匯入(原本的壞掉了)
  3. 森林未建構
  4. 聲波的視覺感
  5. 夜晚的樹會不真實

本周優化周

VR Real Week14


期末作品  天空場景

Week14

在VR中有幾種移動方式,我們一開始有考慮用順一的方式,但後來還是覺得用touchpad控制上下左右比較有操作感。但缺點就是會因為頭盔的轉向而導致座標軸的錯誤,這個問題是我們一開始考慮的點,而譽嘉則提出我們不做移動,而是以場景切換取代。但可能是這個提議,讓我們有了將關卡與密室主體分開的構想。

旋轉移動程式

手把控制 兩手trigger控制抓取物品
左手touchpad控制移動