- Home /
Question by
IJas13 · Oct 23, 2017 at 03:47 PM ·
player movementinput.touchx axisonly
Touch movement
public float speed = 0.1F;
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 X plane
transform.Translate(-touchDeltaPosition.x * speed, 0, 0);
}
}
how can i do it that my Player moves when i drag on it (it should only move in the x axis) i have finished the game but this thing with the touch input is missing,
please help
Comment
What does not work with your current code? You will find plenty of scripts used to drag an object on Unity Answers.
1st: it dosent work, where should i put the code to move my player 2nd: i want that the mobiel input works like the game Rolling Sky
pls Help i dont no how its work with the mobile input
Your answer

Follow this Question
Related Questions
How do I only add drag on the x axis in unity2D? 2 Answers
Error: CS0200 | Read only array? 1 Answer
how can i touch the fast objects ? 0 Answers
Input doesnt work in standalone build 1 Answer
Unity Space Gravity 0 Answers