Smooth "Flappybird"

Hello, i wanna do something like Flappybird,just with an Airplane.When i keep pressing its keep going up,everything fine, but its going up with “steps” just like it would go up an stair.How can i make,that its going up smooth?And how can i make an white line behind the players way?Just like an path wich the players flew.My idea is the game “Sky glider”

using UnityEngine;
using System.Collections;

public class Playermovement : MonoBehaviour {

Vector3 velocity =;
public Vector3 gravity;
public Vector3 flapVelocity;
public float maxSpeed = 5f;
public float fixedvelocity = 1f;

bool didFlap = false;

// Use this for initialization
void Start () {


void Update() {

	if (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0) ) {

		didFlap = true;



// Update is called once per frame
void FixedUpdate () {

	velocity.x = fixedvelocity;
	velocity += gravity * Time.deltaTime;

	if (didFlap == true) {

	didFlap = false;

		if(velocity.y <0)
			velocity += flapVelocity;


	velocity = Vector3.ClampMagnitude (velocity, maxSpeed);

	transform.position += velocity * Time.deltaTime;



velocity = Vector3.ClampMagnitude (velocity, maxSpeed);

I think you have a big problem here. If velocity>maxSpeed then they’ll modify it’s x direction to. so why don’t you:

 velocity = Vector3.Min (velocity, maxSpeed);

And make sure maxSpeed is always more than flagVelocity

PS: May bit off topic. But I think when it’s flagged it should be velocity = flapVelocity;