Example Code:
using UnityEngine;
using System.Collections;
public class AccelerometerInput : MonoBehaviour {
float accX=0,maxSpeed=8;
void FixedUpdate(){
float move = Input.acceleration.x;
rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
//transform.Translate(new Vector2(move * maxSpeed * Time.deltaTime,0));
}
}

No comments:
Post a Comment
Silahkan