Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input.acceleration的判讀 #4

Open
tzutzu858 opened this issue Apr 10, 2020 · 0 comments
Open

Input.acceleration的判讀 #4

tzutzu858 opened this issue Apr 10, 2020 · 0 comments

Comments

@tzutzu858
Copy link
Owner

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

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

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

前面先宣告float threshold = 0.2f;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant