API
Transform { eulerAngles rotation } Transform 类中的两个属性均可以对物体进行旋转操作
hRotation += Input.GetAxis("Horizontal"); vRotation += Input.GetAxis("Vertical"); transform.eulerAngles = new Vector3(vRotation, 0, 0); transform.rotation = Quaternion.Euler(0, hRotation, 0);//这样会出现只能水平旋转,垂直方向不能旋转
hRotation += Input.GetAxis("Horizontal"); vRotation += Input.GetAxis("Vertical"); //transform.eulerAngles = new Vector3(vRotation, hRotation, 0); //transform.eulerAngles = new Vector3(vRotation, hRotation, 0);
transform.rotation = Quaternion.Euler(vRotation, hRotation, 0); //这三种方式均可以实现对物体的旋转
时间: 2024-10-23 23:19:06