标签:调整 star start bsp vector time pre line 一个
public float speed = 3;
public float angleval = 15;
注意要加上public才能在unity中输入调整。
1、用鼠标控制物体旋转(下面是,鼠标右键控制物体沿着y轴正方向旋转,顺时针)
float angleval = 15; void Start() { } // Update is called once per frame void Update() { Move(); if (Input.GetMouseButton(0)) { angleval += angleval * Time.deltaTime; transform.rotation = Quaternion.AngleAxis(angleval, Vector3.up); } }
2、瞄准一个物体移动
Move(); if(Input.GetMouseButton(0)) { angle += angle * Time.deltaTime; transform.rotation = Quaternion.AngleAxis(angle, Vector3.up); } if (Input.GetMouseButton(1)) { transform.rotation = Quaternion.LookRotation(target.position - transform.position); Debug.DrawLine(transform.position, target.position, Color.white, 10f); transform.Translate(Vector3.forward * speed * Time.deltaTime); } if (Input.GetKey(KeyCode.Space)) { transform.rotation = Quaternion.LookRotation(target2.position - transform.position); Debug.DrawLine(transform.position, target2.position, Color.white, 10f); transform.Translate(Vector3.forward * speed * Time.deltaTime); }
标签:调整 star start bsp vector time pre line 一个
原文地址:https://www.cnblogs.com/h694879357/p/12592699.html