Compare commits

..

3 Commits
main ... branch

@ -10,27 +10,28 @@ public class HMDControl : MonoBehaviour
public GameObject handleft; public GameObject handleft;
public GameObject handright; public GameObject handright;
private int speed=1; private int speed=1;
public float moveSpeed = 5f;
public float turnSpeed = 100f;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
head.transform.position +=new Vector3(0,1,0) * 2.8f; head.transform.position +=new Vector3(0,1,0) * 2.8f;
handright.transform.position = new Vector3(-0.77f, 0.94f, 2.1f);
handleft.transform.position = new Vector3(-0.47f, 0.94f, 1.5f);
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
// 获取水平和垂直输入
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical"); float moveDirection = Input.GetAxis("Vertical"); // W 和 S 键
float turnDirection = Input.GetAxis("Horizontal"); // A 和 D 键
// 根据输入移动物体
Vector3 movement = new Vector3(h, 0f, v); // 移动
head.transform.Translate(movement * speed * Time.deltaTime); head.transform.Translate(Vector3.forward * moveDirection * moveSpeed * Time.deltaTime, Space.Self);
//handleft.transform.position = new Vector3(0.063f, 2.022f, 0.745f) ;
//handleft.transform.eulerAngles = new Vector3(-110, -80, -179); // 转向
head.transform.Rotate(Vector3.up, turnDirection * turnSpeed * Time.deltaTime, Space.Self);
} }
} }

@ -1115,7 +1115,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 509285653} m_GameObject: {fileID: 509285653}
m_Enabled: 1 m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6d6e19972d8984547b7008d21841fe57, type: 3} m_Script: {fileID: 11500000, guid: 6d6e19972d8984547b7008d21841fe57, type: 3}
m_Name: m_Name:
@ -2172,10 +2172,18 @@ PrefabInstance:
propertyPath: m_Constraints propertyPath: m_Constraints
value: 112 value: 112
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8834320319295017361, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3}
propertyPath: m_IsKinematic
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8834320319295017362, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3} - target: {fileID: 8834320319295017362, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: HandPlayer value: HandPlayer
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8834320319295017362, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8834320319295017374, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3} - target: {fileID: 8834320319295017374, guid: fdc3ba53f4e81a040b0471bbbafbb10a, type: 3}
propertyPath: m_Material propertyPath: m_Material
value: value:
@ -4434,6 +4442,8 @@ MonoBehaviour:
head: {fileID: 509285653} head: {fileID: 509285653}
handleft: {fileID: 2053242896} handleft: {fileID: 2053242896}
handright: {fileID: 1724965350} handright: {fileID: 1724965350}
moveSpeed: 5
turnSpeed: 100
--- !u!1 &1724965350 --- !u!1 &1724965350
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

Loading…
Cancel
Save