plane control
Hello, I am working on a game like Missiles or Go Plane (Voodoo game) its simply you're trying to avoid missiles. But I have a problem in coding. I cant control smooth on android device.
Is there any tips for that kind of controller? [Go Plane Gameplay][1] [1]: https://www.youtube.com/watch?v=tpgDlVkzmwU
And this is my code. I am simply trying to make a controller like that. Any help would be appreciated. What should I do or is there any guide for that?
if (Input.touchCount >0)
{
Touch touch = Input.GetTouch(0);
Vector2 touchPos = Camera.main.ScreenToWorldPoint(touch.position);
switch(touch.phase)
{
case TouchPhase.Began:
deltaX = touchPos.x - transform.position.x;
deltaY = touchPos.y - transform.position.y;
break;
case TouchPhase.Moved:
rb.MovePosition(new Vector2(touchPos.x - deltaX, touchPos.y - deltaY));
break;
case TouchPhase.Ended:
rb.velocity = Vector2.zero;
break;
}
}
Your answer
Follow this Question
Related Questions
can you read json file on android ? I have a thesis and it's not going well. 1 Answer
Read and save current git commit hash into script 1 Answer
Why does my game lag horribly and how can I fix it? 0 Answers
How can i use virtual joystick for control fps character controller? 0 Answers
Unity 2D game heats up my phone!!! 1 Answer