- Home /
How to Move the Car With Touch?
hello I'm in big trouble, My car does not slip when walking the up button, I have not found the answer anywhere, I think if you can get the q UP key to the character of the movement may resolve but also do not know that.
my code:
if (Input.touchCount > i && Input.GetTouch(0).deltaPosition.y> 0 && Input.GetAxis("Vertical") ) {
FrontWheel.motorTorque = 500;
i = 1;
print (vertical);
}
it comes to recognize the touch but doesnt move..
Comment
Answer by Thiago_VT · Nov 23, 2012 at 08:02 PM
Solved!!! After a lot search and tests i found a way! There is my Code!
if (Input.touchCount > i && Input.GetTouch(0).deltaPosition.y >20 && Input.GetTouch(0).phase == TouchPhase.Moved )
{
FrontWheel.motorTorque = 300;
rigidbody.AddForce(Vector3.zero*550*Time.deltaTime, ForceMode.Force);
}
My car move now correctly!
Your answer
Follow this Question
Related Questions
How to touch, move and rotate 3D objects in XZ? 1 Answer
Different animations on mobile 0 Answers
How can I move player sideways by dragging with mouse or with mobile device when pressed down? 0 Answers
Touch Controls for mobile 1 Answer
Android: After the third touch all touches get cancelled 1 Answer