Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

Getting started to make an aircraft that can take off and be controlled using WASD keyboard buttons on Unity

Posted on March 27, 2021March 27, 2021 by Habibie

In this video I am trying to make an airplane that can take off and be controlled using my WASD buttons on my keyboard.

It is somehow an experiment and also a tutorial, so please don’t be mad if I made mistakes in this video before finally I made my way to fix any problem along the way.

Check out this TNAirPlane C# script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TNAirPlane : MonoBehaviour
{
	
	public float thrust = 10f;
	public float topspeed = 20f;
	public float defaultLift = 1f;
	
	Rigidbody rb;
	
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
		rb.velocity = transform.forward * thrust;
		transform.Rotate(defaultLift,0,0);
		
		if(Input.GetKey(KeyCode.W)){
			transform.Rotate(.5f,0,0);
		}
		if(Input.GetKey(KeyCode.S)){
			transform.Rotate(-.5f,0,0);
		}
		if(Input.GetKey(KeyCode.A)){
			transform.Rotate(0,0,.5f);
		}
		if(Input.GetKey(KeyCode.D)){
			transform.Rotate(0,0,-.5f);
		}
		
    }
}

Check out the complete parts of this tutorial here: https://thirteenov.ciihuy.com/making-an-airplane-game-from-scratch-in-unity/

Post Views: 670
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
  • Advanced Blinking Marker Script to show objects position in your game canvas
  • Ciihuy Images Merger – Fast & Easy Online Image Combiner
© 2025 ThirteeNov | Powered by Superbs Personal Blog theme