3. shapethefuture
動態剛體屬性
Material
剛體材料
Simulated
是否啟用物理引擎模擬剛體功能
Use Auto Mass
是否依據元件的碰撞器自動計算物體質量
Mass
物體質量
Linear Drag
物體移動的阻力係數
Angular Drag
物體旋轉的阻力係數
剛體 2/5
Wu, ShyiShiou Dept. of E.E., NKUT3
29. shapethefuture
Main Camera元件加入CameraController程式腳本,關閉鏡頭旋轉
public class CameraController : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.transform.eulerAngles = Vector3.zero;
}
}
執行測試
飛碟可以在邊界內飛行,背景圖也不會旋轉了
讓Camera鏡頭跟著飛碟移動 2/2
Wu, ShyiShiou Dept. of E.E., NKUT29
32. shapethefuture
Pickups元件加入PickupController程式腳本,讓金塊自主旋轉
public class PickupController : MonoBehaviour {
public float RotateSpeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.transform.Rotate (new Vector3(0,0,RotateSpeed*Time.deltaTime));
}
}
佈置金塊道具 3/5
Wu, ShyiShiou Dept. of E.E., NKUT32