2016年5月26日 星期四

Week14_許志遙_FinalHWTest

我們先在Unity上做出射擊的專案
設定好前進、往左、往右以及射擊

接著我們加入※FAAST,作為連接Kinect的道具


讓我們來看看成果吧
1. 站立,不做任何動作
2. 前進
   
3.向左


4.向右

5.射擊








Week14_期末進度_02160421黃志楷

第十四週課程:期末進度

Week14:Final Project

第一節課(準備)

1. 先下載並安裝 sdk 以及 KinectDeveloperToolkit


2.安裝完成


3.出了些問題,所以要去老師電腦下載



4.下載完裝到C:\Users\S405\Desktop\processing-

2.2.1\modes\java\libraries 解壓就好


*要先關掉在打開才會有用喔*

*而且一定要用32bits 否則無法使用*




第二三節課(faast)



利用FAAST模擬鍵盤與滑鼠並套入 UNITY 來進行


初始畫面


往前走


往左走


往右走


開槍射擊


討論想要模擬cs1.6的模式














02162411_劉永健_Week14

今天繼續做期末作品
不過我們的方向有一點改動

主角換成人

不過放心,依然是坦克遊戲哦~!

基本設定就是主角打坦克
更加提升了體驗度,不像體感控制坦克那麼生硬哦

你的肢體就在遊戲中,是不是很有融入實境的感覺呢!


地形場景:

在這個遊戲中,主角基本上是不能移動的,坦克會從四面八方開過來,要做的是把開來的坦克擊退,所以主角放在一個四通八達的十字路口,坦克可以從五條路,也就是五個方向開過來。另外這個地形挺大的,匯入後已經開始卡了,更不要說再加上其它的程式、邏輯判斷,最後會變得更卡。

因為這次要做的是PC遊戲,與手游不同的地方是,畫面的質量可以做得奢侈一點,但再怎麼奢侈,也不能用太浪費記憶體,需要用到一點資源優化的只是,不然即使是PC也會帶不動。

針對場景大這個問題,最適合用的方法就是遮擋剔除(Occlusion Culling)了(這個功能我之前也稍微研究過),雖然Unity Pro版的效果會更好更強大,但Unity標準版還是能用的,這個地方就是遮擋剔除的介面:


那遮擋剔除有什麼用呢,看這張圖就明白了:



遮擋剔除就是針對大場景優化的,只有攝影機看到的地方才會

渲染出來,被遮擋的地方不會渲染,這樣就可以大幅度降低

GPU的負擔了。

然後其它的畫質就可以隨心所欲地調到很高:


week14_期末gogogo_呂登祐


目前進度...
   

Week14 0526

尋找期末作品素材及製作:



老師教學:





Week14 金博鈞

試著寫出揮手的手勢辨識

import SimpleOpenNI.*;
SimpleOpenNI openni;

void setup() {
  size(640, 480);
  openni = new SimpleOpenNI(this);
  openni.enableRGB();
  openni.enableDepth();
  openni.enableUser();
}

void draw(){
  openni.update();
  background(255);
  image(openni.userImage(), 2,2.4,640,480);
  int [] userList = openni.getUsers();
  PVector pos = new PVector(0,0,0);
  PVector pos2 = new PVector(0,0,0);
  for(int userID : userList){
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_RIGHT_HAND, pos);
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_HEAD, pos2);
  }
   ellipse(pos.x, pos.y, 50,50);
   ellipse(pos2.x, pos2.y, 50,50);
   println(pos);
   Wave();
}

void Wave(){
  int [] userList = openni.getUsers();
  PVector pos = new PVector(0,0,0);
  PVector pos2 = new PVector(0,0,0);
  for(int userID : userList){
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_RIGHT_HAND, pos);
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_HEAD, pos2);
  }
  if(pos.x>pos2.x+0.5)
  {
    println("WAVE");
  }
}


void onNewUser(SimpleOpenNI openni,int userId)
{
  openni.startTrackingSkeleton(userId);
}

加上王冠甲的程式碼
import SimpleOpenNI.*;

SimpleOpenNI  openni;
color[]       userClr = new color[]{ color(255,0,0),
                                     color(0,255,0),
                                     color(0,0,255),
                                     color(255,255,0),
                                     color(255,0,255),
                                     color(0,255,255)
                                   };
PVector com = new PVector();                                
PVector com2d = new PVector();                                

void setup()
{
  size(640,480);

  openni = new SimpleOpenNI(this);
  if(openni.isInit() == false)
  {
     println("Can't init SimpleOpenNI, maybe the camera is not connected!");
     exit();
     return;
  }

 
  openni.enableDepth();
 
  openni.enableUser();

  background(200,0,0);

  stroke(0,0,255);
  strokeWeight(3);
  smooth();
}

void draw()
{
  openni.update();
  PVector pos = new PVector(0,0,0), hand1=new PVector(0,0,0), hand2=new PVector(0,0,0);
  int[] userList = openni.getUsers();
  image(openni.userImage(),0,0);
  for(int userID : userList){
    openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_LEFT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(0,255,0);ellipse(pos.x,pos.y,50,50); hand1.set(pos); hand1.z=0;
    fill(0,255,0);ellipse(pos.x/10, pos.y/10, 5,5);
    openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_RIGHT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(0,255,0);ellipse(pos.x/10,pos.y/10, 5,5);
    fill(0,255,0);ellipse(pos.x, pos.y,50,50); hand2.set(pos); hand2.z=0;
  }
  for(int i=0;i<userList.length;i++)
  {
    if(openni.isTrackingSkeleton(userList[i]))
    {
      stroke(userClr[ (userList[i] - 1) % userClr.length ] );
      drawSkeleton(userList[i]);
    }
    if(openni.getCoM(userList[i],com))
    {
      openni.convertRealWorldToProjective(com,com2d);
      stroke(100,255,0);
      strokeWeight(1);
      beginShape(LINES);
        vertex(com2d.x,com2d.y - 5);
        vertex(com2d.x,com2d.y + 5);
        vertex(com2d.x - 5,com2d.y);
        vertex(com2d.x + 5,com2d.y);
      endShape();
      fill(0,255,100);
      text(Integer.toString(userList[i]),com2d.x,com2d.y);
    }
  }
  Wave();
  println(pos.x);
}
void drawSkeleton(int userId)
{
  openni.drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);

  openni.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND);

  openni.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND);

  openni.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_TORSO);

  openni.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_LEFT_HIP);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP, SimpleOpenNI.SKEL_LEFT_KNEE);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE, SimpleOpenNI.SKEL_LEFT_FOOT);

  openni.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_RIGHT_HIP);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP, SimpleOpenNI.SKEL_RIGHT_KNEE);
  openni.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE, SimpleOpenNI.SKEL_RIGHT_FOOT);
}
void onNewUser(SimpleOpenNI curContext, int userId)
{
  println("onNewUser - userId: " + userId);
  println("\tstart tracking skeleton");

  curContext.startTrackingSkeleton(userId);
}

void Wave(){
  int [] userList = openni.getUsers();
  PVector pos = new PVector(0,0,0);
  PVector pos2 = new PVector(0,0,0);
  for(int userID : userList){
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_RIGHT_HAND, pos);
     openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_HEAD, pos2);
  }
  if(pos.x>pos2.x+0.5)
  {
    println("WAVE");
  }
}

02163042_王冠閔_week14

期末作品製作

Week 14 葉正聖老師示範

期末作品示範教學
1.

2016體感互動 Week 14 跳舞機 Part 1 如何讓2種米老鼠圖片 在3個位置掉落



2016體感互動 Week 14 跳舞機 Part 2 消掉不同色彩的米老鼠


其他時候, 則是一對一教學, 教同學如何解決遇到的實作問題。


2016年5月19日 星期四

Week13_期末進度_02160421黃志楷

 第十三週課程:期末進度

Week13:Final Project

第一節課(準備)

1. 先下載並安裝 sdk 以及 KinectDeveloperToolkit


2.安裝完成


3.出了些問題,所以要去老師電腦下載



4.下載完裝到C:\Users\S405\Desktop\processing-

2.2.1\modes\java\libraries 解壓就好


*要先關掉在打開才會有用喔*

*而且一定要用32bits 否則無法使用*






第二節課(詳細討論)


1.決定使用 unity 搭配 kinect










2.利用ak47 射鏢靶













3.使用 FAAST 來模擬鍵盤

http://otaru.tw/older-archives/faast-%E7%94%A8kinect%E8%A3%BD%E4%BD%9C%E9%AB%94%E6%84%9F%E4%BA%92%E5%8B%95%E6%88%96%E9%81%8A%E6%88%B2%E4%B9%8B%E7%B0%A1%E6%98%93%E6%95%99%E5%AD%B8

此軟體是由USC 製作出來的





week13_期末進度_呂登祐

作品名稱: 跳舞


構想:

分兩大部分:

1.人物跳舞
    玩家跟著螢幕上的人物動作跳舞

2.計分系統
     主要以特效為主


To be coming soon ...

week13_期末進度



import SimpleOpenNI.*;
SimpleOpenNI openni;
PImage imgBG,imgHuman;
void setup(){
  size(600,400);
  openni = new SimpleOpenNI(this);
  openni.enableRGB();
  openni.enableDepth();
  openni.enableUser();
  imgBG = loadImage("bg.png");
  imgHuman = createImage(640,480,ARGB);
}

void draw(){
  openni.update();
  background(255);
  image(imgBG,0,0,640,480);
  image(openni.userImage(),0,0,64,48);
  copyImage();
  int[]userList = openni.getUsers();
  PVector pos = new PVector(0,0,0), hand1 = new PVector(0,0,0), hand2 = new PVector(0,0,0);
  for(int userID : userList){
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_LEFT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(0,0,255);
    ellipse(pos.x, pos.y, 50, 50);
    hand1.set(pos);
    hand1.z=0;
    fill(0,0,255);
    ellipse(pos.x/10, pos.y/10, 5, 5);
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_RIGHT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(255,0,0);
    ellipse(pos.x/10, pos.y/10, 5, 5);
    fill(255,0,0);
    ellipse(pos.x, pos.y, 50, 50);
    hand2.set(pos);
    hand2.z=0;
    //openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_HEAD, pos);
    //openni.convertRealWorldToProjective(pos, pos);
    //fill(255,255,0);
    //ellipse(pos.x, pos.y, 50, 50);
  }
  image(imgHuman,0,0,640,480);
  PVector mouse1 = new PVector(mouseX, mouseY, 0);
  if(PVector.dist(mouse1, hand1)<100 || PVector.dist(mouse1, hand2)<100){
    ellipse(mouseX, mouseY, 200, 200);
    //fill(255,255,0);
  }
}
void copyImage(){
  PImage now = openni.userImage();
  now.loadPixels();
  for(int i=0;i<640*480;i++){
    if(now.pixels[i]==color(255,0,0) ||
       now.pixels[i]==color(0,255,0) ||
       now.pixels[i]==color(0,0,255) ||
       now.pixels[i]==color(255,255,0)){
         imgHuman.pixels[i]=color(255,0,0,120);
         println(i);
       }else{
         imgHuman.pixels[i]=color(0,0);
       }
       imgHuman.updatePixels();
  }
}
void onNewUser(SimpleOpenNI curContext,int userId){
  openni.startTrackingSkeleton(userId);
}




import SimpleOpenNI.*;
import processing.opengl.*;
import saito.objloader.*;
SimpleOpenNI openni;
OBJModel model;
PImage imgBG,imgHuman;
void setup(){
  size(600,400);
  model = new OBJModel(this, "000.obj");
  model.scale(80);
  model.translateToCenter();
  noStroke();
  openni = new SimpleOpenNI(this);
  openni.enableRGB();
  openni.enableDepth();
  openni.enableUser();
  imgBG = loadImage("bg.png");
  imgHuman = createImage(640,480,ARGB);
}

void draw(){
  openni.update();
  background(255);
  lights();
  translate(width/8,height/8,0);
  model.draw();
  image(imgBG,0,0,640,480);
  image(openni.userImage(),0,0,64,48);
  copyImage();
  int[]userList = openni.getUsers();
  PVector pos = new PVector(0,0,0), hand1 = new PVector(0,0,0), hand2 = new PVector(0,0,0);
  for(int userID : userList){
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_LEFT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(0,0,255);
    ellipse(pos.x, pos.y, 50, 50);
    hand1.set(pos);
    hand1.z=0;
    fill(0,0,255);
    ellipse(pos.x/10, pos.y/10, 5, 5);
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_RIGHT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(255,0,0);
    ellipse(pos.x/10, pos.y/10, 5, 5);
    fill(255,0,0);
    ellipse(pos.x, pos.y, 50, 50);
    hand2.set(pos);
    hand2.z=0;
    //openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_HEAD, pos);
    //openni.convertRealWorldToProjective(pos, pos);
    //fill(255,255,0);
    //ellipse(pos.x, pos.y, 50, 50);
  }
  image(imgHuman,0,0,640,480);
  PVector mouse1 = new PVector(mouseX, mouseY, 0);
  if(PVector.dist(mouse1, hand1)<100 || PVector.dist(mouse1, hand2)<100){
    ellipse(mouseX, mouseY, 200, 200);
    //fill(255,255,0);
  }
}
void copyImage(){
  PImage now = openni.userImage();
  now.loadPixels();
  for(int i=0;i<640*480;i++){
    if(now.pixels[i]==color(255,0,0) ||
       now.pixels[i]==color(0,255,0) ||
       now.pixels[i]==color(0,0,255) ||
       now.pixels[i]==color(255,255,0)){
         imgHuman.pixels[i]=color(255,0,0,120);
         println(i);
       }else{
         imgHuman.pixels[i]=color(0,0);
       }
       imgHuman.updatePixels();
  }
}
void onNewUser(SimpleOpenNI curContext,int userId){
  openni.startTrackingSkeleton(userId);
}

02160040_周子伍, Week13

討論期末作業如何製作

構思和分配

我們的題目為穿牆小遊戲



week13 期末作品構想

今天我們大致想了我們遊戲的進行模式,以下是我們的構想:
一開始有主畫面,將手放在start上3秒即遊戲開始。
接下來進入遊戲畫面,分別偵測左手為藍色、右手為紅色,畫面中隨機掉下藍色與紅色的圖,遊戲方法是用手去處碰掉下的圖,必須是相同的顏色才可消除,如果球碰到畫面最底部遊戲就結束。

下圖為遊戲背景

02160740_莊鎧旭_Week13

期末作品題目-星球殞落 高健智 莊鎧旭

星球殞落 :

天上會有很多隕石掉落在地球,我們必須要做自己的方式來,將隕石彈回宇宙才能保為地球。

組員 高健智 莊鎧旭


「星球」的圖片搜尋結果

Week13 金博鈞

作期末進度

SimpleOpenNI openni;
PVector []pos=new PVector[17];

void setup() {
  size(640, 480);
  openni = new SimpleOpenNI(this);
  openni.enableRGB();
  openni.enableDepth();
  openni.enableUser();
}

void draw() {
  openni.update();
  background(255);
  image(openni.userImage(), 9, 9, 32*4, 24*4);
  int[] userList=openni.getUsers();
  for (int userID : userList) {
    for (int i=0; i<16; i++) {
      openni.getJointPositionSkeleton(userID, i, pos[i]);
      openni.covertRealWorldToProjective(pos[i], pos[i]);
      fill(0);
      ellipse(pos[i].x, pos[i].y, 50, 50);
    }
  }
}



02163042_王冠閔_week13

期末作品 

呼巴掌出氣遊戲


01160235_謝采玲, Week13

期末作品製作


平衡球


遊戲內容:
玩家需要平衡
讓球滾到目的地


遊戲方法:
玩家左手比右手高=>木板(場地)往右傾斜
玩家右手比左手高=>木板(場地)往左傾斜


考慮玩家的角色是:
1. 玩家是木板
2. 玩家是人,人握住木板,讓木板動
3. 玩家是球


遊戲製作步驟:
1. Kinect 結合 Unity(依動作可以控制木板傾斜)
2. 製作平衡球的場地,越多越好
3. 其他功能 















Week 13,02160261,鄧安倫

Week 13


2016/5/19

期末作品:跳舞

期末作品想法:

人跟著螢幕裡的人物做動作,動作一致就加分~
動作不正確不給分也不扣分~


今天製作期末作業!

今天製作期末作業!

下面是我們希望製作的流程:

1.偵測手(拳擊的手.貼圖)
import SimpleOpenNI.*;
SimpleOpenNI openni;
void setup(){
  size(600,400);
  openni = new SimpleOpenNI(this);
  openni.enableRGB();
  openni.enableDepth();
  openni.enableUser();
}
void draw(){
  openni.update();
  background(255);
  image(openni.userImage(),0,0,640,480);
  int[]userList = openni.getUsers();
  PVector pos = new PVector(0,0,0);
  for(int userID : userList){
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_LEFT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(0,0,255);
    ellipse(pos.x, pos.y, 50, 50);
    openni.getJointPositionSkeleton(userID, SimpleOpenNI.SKEL_RIGHT_HAND, pos);
    openni.convertRealWorldToProjective(pos, pos);
    fill(255,0,0);
    ellipse(pos.x, pos.y, 50, 50);

  }
  ellipse(pos.x, pos.y, 50, 50);
  println(pos);
}
void onNewUser(SimpleOpenNI curContext,int userId){
  openni.startTrackingSkeleton(userId);
}

2.準備畫面/結束畫面
3.計時/血量
4.對手
5.背景圖(會動的貼圖)
6.音效/(特效)