tzutzu858 / jump

查克尋找威爾森的jump小遊戲
0 stars 0 forks source link

Input.acceleration的判讀 #4

Open tzutzu858 opened 4 years ago

tzutzu858 commented 4 years ago

Acceleration所回傳的數值是一個三維向量Vector3 也就是一個XYZ的組合

當手機的傾斜大於一定值讓角色左右移動


if(Input.acceleration.x > this.threshold) key = 1;
if(Input.acceleration.x < -this.threshold) key = -1;

前面先宣告float threshold = 0.2f;