Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class paddle : MonoBehaviour {
- float size = 1;
- float screenSize = 16;
- // Update is called once per frame
- void Update () {
- Vector3 position = new Vector3 (Mathf.Clamp (this.transform.position.x, size / 2, screenSize - size/2),
- this.transform.position.y,
- this.transform.position.z);
- position.x = Input.mousePosition.x / Screen.width * screenSize;
- this.transform.position = position;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement