1
我需要移動GVR凸輪在遊戲中移動,但在Android應用中它不動... 我已經使用這個代碼已經嘗試過:我的球員不會在我的GVR應用
public class controller : MonoBehaviour {
private bool walking = false;
private Vector3 spawnPoint;
void Start() {
spawnPoint = transform.position;
}
void Update() {
if (walking)
{
transform.position = transform.position + Camera.main.transform.forward * 3 * Time.deltaTime;
}
if (transform.position.y <-10f)
{
transform.position = spawnPoint;
}
Ray ray = Camera.main.ViewportPointToRay(new Vector3(.5f, .5f, 0));
RaycastHit hit;
if (Physics.Raycast (ray, out hit))
{
if (hit.collider.name.Contains("plane"))
{
walking = false;
} else
{
walking = true;
}
}
}
In the image linked here there is my plane