using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallMovingScript : MonoBehaviour
{
Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement;
}
}
ภาพที่ 5-9 ทำการแก้ไข script แล้วกดปุ่ม save ภาพที่ 5-10 กลับไปที่ program unity3D คลิกปุ่ม play แล้วกดปุ่มลูกศร ซ้ายขวาบนล่างบน keyboard ลูกบอลจะเคลื่อนที่
ตรงกลาง ปุ่ม เล่น ปุ่ม หยุด และปุ่มเล่นทีละ step จะเป็นปุ่มที่เราจะใช้เมื่อต้องการ test เกม
ภาพที่ 2 แสดงเมนูและ tool bar
2. Scene, Game, Asset store
ส่วนนี้จะแสดงเป็น tab 3 tab ประกอบด้วย
scene เป็นหน้าจอที่เราใช้วางวัตถุในเกม
Game เป็นหน้าจอที่เราใช้ทดสอบเล่นเกม เมื่อกดปุ่ม play
Asset store เป็นหน้าจอที่ Link ไปยังเว็บของ unity เพื่อ download content (เรียกว่า asset) ไม่ว่าจะเป็น model ภาพ เสียง ต่างๆ มีทั้งฟรีและเสียเงิน
ภาพที่ 3 หน้าจอที่ประกอบด้วย 3 tab คือ scene Game และ asset store สำหรับหน้าจอนี้คือหน้าจอ game จะใช้เมื่อต้องการทดสอบเล่นเกมที่เราสร้างขึ้นภาพที่ 4 หน้าจอ Scene เป็นหน้าจอที่ใช้ในการวางวัตถุต่างๆในเกมภาพที่ 5 หน้าจอ Asset store เชื่อมโยงไปยังเว็บของ Unity เพื่อ download asset ต่างๆ