代码如下,lookrotation可以实现将物体的方向转到moveRotation的方向,而moveRotation接受了水平轴的输入,为何转向时只会旋转90度导致2d平面消失?
//实现wasd移动
moveY = Input.GetAxis("Vertical");
moveX = Input.GetAxis("Horizontal");
moveY *= Speed / (1 / Time.deltaTime + 1);
moveX *= Speed / (1 / Time.deltaTime + 1);
Vector3 move = new Vector3(moveX, moveY);
Vector3 moveconsequence = move + transform.position;
playerplace.transform.position = moveconsequence;
//实现转向
Vector2 moveRotation = new Vector2(moveX,0f);
transform.rotation = Quaternion.LookRotation(moveRotation);