Skip to content
Om Puter

Om Puter

Berbagi Tutorial Coding dan Pemrograman Komputer

Menu
  • Channel YouTube ThirteeNov
  • Channel YouTube Om Puter
Menu

Cara membuat pesawat terbang di Unity dan membuat kontrol pesawat dengan menggunakan tombol WASD di keyboard

Posted on 27 Maret 202127 Maret 2021 by OmPuter

Di video tutorial ini saya akan berbagi pengetahuan game development Unity tentang cara membuat pesawat terbang yang bisa kamu kendalikan dengan memencet tombol WASD di keyboard.

Berikut ini script Pesawat.cs yang kamu lihat di video di atas:

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

public class Pesawat : MonoBehaviour
{
	
	public float kecepatan = 10f;
	
	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 * kecepatan;
		
		if(Input.GetKey(KeyCode.W)){
			transform.Rotate(.1f,0,0);
		}
		if(Input.GetKey(KeyCode.S)){
			transform.Rotate(-.1f,0,0);
		}
		if(Input.GetKey(KeyCode.A)){
			transform.Rotate(0,0,.6f);
		}
		if(Input.GetKey(KeyCode.D)){
			transform.Rotate(0,0,-.6f);
		}
    }
}
Post Views: 1,224

Kategori

  • 3D Max
  • Adobe Animate
  • Android
  • c#
  • Cordova
  • HTML5, CSS & JavaScript
  • iOS
  • Lain-lain
  • Photoshop
  • PHP
  • Python
  • Roblox
  • Tak Berkategori
  • Unity
  • WordPress
ciihuy2020
© 2026 Om Puter | Powered by Superbs Personal Blog theme