Question by
mukilol · Jun 27, 2016 at 07:28 PM ·
androidcameracamera-movementcamera movement
Touch camera movement isn't smooth on Android
Hey!
I got the following code that is supposed to move the camera up and down in my game:
using UnityEngine;
using System.Collections;
public class TouchControl : MonoBehaviour {
public float speed = 0.5F;
void Update() {
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
// Get movement of the finger since last frame
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
// Move object across XY plane
transform.Translate(0, -touchDeltaPosition.y * speed, 0);
}
}
}
The code works fine but on my phone it's not smooth at all when swiping up and down, does someone have any idea how I can fix this?
Comment
Your answer
Follow this Question
Related Questions
How to set movement limit to Camera in a top-down 3D game 0 Answers
ARCore not updating camera feed 0 Answers
Camera change targets when new object appears or Camera change targets by pressing a button 1 Answer
Camera bounds with zoomable camera 1 Answer
How to limit/Clamp RotateAround for camera movement? 0 Answers