- Home /
Question by
SirMcsquizy · Feb 04, 2014 at 05:20 PM ·
androidjavascripttouch
Android touch question
Hey Everybody!
So, I have been trying to figure out how to make a ship go up and down and side to side. Ive only been able to make it go side to side and straight forward, and I can't figure out why.
Here's some of the code
if (Input.touches[0].phase == TouchPhase.Moved)
{
float x = Input.touches[0].deltaPosition.x * speed * Time.deltaTime;
float y = Input.touches[0].deltaPosition.y * speed * Time.deltaTime;
transform.Translate(Vector3(x, y, 0));
}
If you could help that would be great!
Comment
Nothing in that code looks incorrect. Have you double checked that var y is getting set to real data?
you movin' it on the right axis with translate? does the speed variable go negative ever? (cuz if it's negative then maybe it's multiplying by the negative touch input making it positive right?)
Your answer
Follow this Question
Related Questions
Unity touch 1 Answer
Disable gui texture in a different way? 0 Answers
Android touch is not dynamic 1 Answer
android touch input 1 Answer
Unity 2D Mobile Game Drawing Mechanic 0 Answers