Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Move : MonoBehaviour
- {
- public float sensibility = 21;
- public float pc;
- void Update()
- {
- if (gameObject.transform.position.x <= -3)
- {
- gameObject.transform.position = new Vector3(-3, gameObject.transform.position.y, gameObject.transform.position.z);
- }
- if (gameObject.transform.position.x >= 3)
- {
- gameObject.transform.position = new Vector3(3, gameObject.transform.position.y, gameObject.transform.position.z);
- }
- gameObject.transform.position += new Vector3(Input.acceleration.x + pc, 0, 0) * Time.deltaTime * sensibility;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement