You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Vector3 = UnityEngine.Vector3;
|
|
|
|
|
|
|
|
|
|
public class HMDControl : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject head;
|
|
|
|
|
public GameObject handleft;
|
|
|
|
|
public GameObject handright;
|
|
|
|
|
private int speed=1;
|
|
|
|
|
public float moveSpeed = 5f;
|
|
|
|
|
public float turnSpeed = 100f;
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
head.transform.position +=new Vector3(0,1,0) * 2.8f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float moveDirection = Input.GetAxis("Vertical"); // W <20><> S <20><>
|
|
|
|
|
float turnDirection = Input.GetAxis("Horizontal"); // A <20><> D <20><>
|
|
|
|
|
|
|
|
|
|
// <20>ƶ<EFBFBD>
|
|
|
|
|
head.transform.Translate(Vector3.forward * moveDirection * moveSpeed * Time.deltaTime, Space.Self);
|
|
|
|
|
|
|
|
|
|
// ת<><D7AA>
|
|
|
|
|
head.transform.Rotate(Vector3.up, turnDirection * turnSpeed * Time.deltaTime, Space.Self);
|
|
|
|
|
}
|
|
|
|
|
}
|