Created
June 20, 2016 23:03
-
-
Save AkshatGiri/25fc81380d3feb208503226787e48ffb to your computer and use it in GitHub Desktop.
Paddle glitching problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Paddle : MonoBehaviour | |
{ | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
Vector3 paddlePos = new Vector3(0.5f, transform.position.y, 0f); | |
float mousePosInBlocks = Input.mousePosition.x / Screen.width * 16; | |
paddlePos.x = Mathf.Clamp(mousePosInBlocks, 0.5f, 15.5f ); | |
this.transform.position = paddlePos; | |
print(Input.mousePosition.x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment