Open tzutzu858 opened 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;
Acceleration所回傳的數值是一個三維向量Vector3 也就是一個XYZ的組合
當手機的傾斜大於一定值讓角色左右移動
前面先宣告float threshold = 0.2f;