2
Z軸找到這個答案在這裏: Rotate a gameobject in Unity旋轉游戲物體上只有C#
我發現這是非常有用的,但我想旋轉只分配給Z軸,我不能去上班。
using UnityEngine;
using System.Collections;
public class Rotation : MonoBehaviour {
public GameObject Player;
public GameObject PlayerCube;
// Use this for initialization
void Start() {
var playerMapPos = Player;
var playerWorldPos = PlayerCube;
PlayerCube.transform.rotation = Player.transform.rotation;
}
// Update is called once per frame
void Update() {
}
}
安置自己的嘗試輪換代碼 – SimpleVar
請閱讀標籤說明在使用它們之前。統一標籤與Unity遊戲引擎無關。 –