View difference between Paste ID: uZ9AZAD3 and zJC7gX4J
SHOW: | | - or go back to the newest paste.
1
void Update () {
2
	//**********************************************************************************
3
	//||||||||||||||||||||||||||||| MOVEMENT |||||||||||||||||||||||||||||||||||||||||||
4
	//**********************************************************************************
5
	if (Input.touchCount > 0) // TOUCHSCREEN CONTROLS
6
	{
7
		// Get movement of the finger since last frame				
8
		touchDeltaPosition = Input.GetTouch(0).deltaPosition;			
9-
		touchDeltaPosition.x *= touchSpeed;
9+
10-
		touchDeltaPosition.y *= touchSpeed;
10+
		// Getting the percentage of the screen that it moved (result is in decimal format like 0.3 for 30%)
11
		touchDeltaPositionWindowPercentage.x = (touchDeltaPosition.x * 100 / globalValues.windowWidth) / 100;
12
		touchDeltaPositionWindowPercentage.y = (touchDeltaPosition.y * 100 / globalValues.windowHeight) / 100;
13-
		transform.Translate(touchDeltaPosition);
13+
			
14
		// Changing the screen percentage to real value
15
		touchDeltaPosition.x = globalValues.windowWidth * touchDeltaPositionWindowPercentage.x * touchSpeed;
16
		touchDeltaPosition.y = globalValues.windowHeight * touchDeltaPositionWindowPercentage.y * touchSpeed;
17
18
		// Move object according to new positions
19
		transform.Translate(touchDeltaPosition * Time.deltaTime);
20
		pos = transform.position;			
21
		transform.position = pos;
22
	}    
23
	//**********************************************************************************
24
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
25
	//**********************************************************************************
26
}