I am developing a simple 3D game with ball. And the ball moves not smoothly.
while (i < Input.touchCount)
{
if(Input.GetTouch(i).position.y < ScreenHeight / 2)
{
if (Input.GetTouch(i).position.x > ScreenWidth / 2)
{
//move right
rigidBody.velocity += new Vector3(0.75f, 0, 0);
}
if (Input.GetTouch(i).position.x < ScreenWidth / 2)
{
//move left
rigidBody.velocity -= new Vector3(0.75f, 0, 0);
}
}
++i;
}
As you can see I used rigid body's velocity and it starts slowly and then goes fast. But I want the ball to move immediately with constant velocity after touching the screen. Also it is moving with jerks, not smoothly. Could you please help me improve it ?
=instead of-=and+=. So it would berigidBody.velocity = new Vector(x,y,z)- Chronicle