Game Design
- Light
- Craft
- Stage
- Car
- Wall
- Barrier
- Obstacle
- Pass
Light
- Directional Light
- Position: (0, 3, 0)
- Rotation: (50, -30, 0)
Craft
- Empty Game Object
Move_craft.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move_craft : MonoBehaviour {
void Start () { }
void Update () {
float xrot_rate = 120 * Time.deltaTime;
float zmoverate = 5 * Time.deltaTime;
float dirx = Input.GetAxis("Horizontal");
float dirz = Input.GetAxis("Vertical");
this.transform.Translate(Vector3.forward * zmoverate * dirz);
this.transform.Rotate(Vector3.up*dirx*xrot_rate);
}
void OnCollisionEnter(Collision other){
print("hit with "+other.gameObject.name);
Debug.Log("avoid "+ other.gameObject.tag);
if (other.gameObject.name == "Pass")
print("Game End");
}
void OnTriggerEnter(Collider other){
print("Pass");
}
}
Stage
- Plane
- Position: (0, 0, 0)
- Scale:(5, 5, 5)
- Color: black
Car
- Asset
- CartoonCarFree
- Physic Material
- Name: ttb
- Dynamic Friction: 0.6
- Static Friction: 0.6
- Bounciness: 0.9
- Rigidbody
- Freeze Position: Y
- Freeze Rotation: Y
- Camera
- Put under Car in Hierarchy to follow car
Wall
- Cube
- Position: (25, 0.5, 0), (-25, 0.5, 0), (0, 0.5, 25), (0, 0.5 -25)
- Scale: (1, 1, 50), (1, 1, 50), (50, 1, 1), (50, 1, 1)
Barrier
- Cube
- Color: white
- Cube for
Pass
- Color: red
Obstacle
- Sphere
- Physic Material
- Name: ttb
Pass
- Cube
- Is Trigger
UI

