我的意思是,当按W键的时候,S,A,D,比方说,按W键,而不是让相机直线向上移动,它同时向上和向左移动.对于所有其他关键点,它同时向两个方向移动.
我正在从更新中调用该方法
private void HandleCameraMovement()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 moveDirection = new Vector3(horizontal, 0f, vertical);
moveDirection.Normalize();
transform.Translate(moveDirection * cameraMoveSpeed * Time.deltaTime, Space.World);
}
我以前也试过了,但结果是一样的:
private void HandleCameraMovement()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 moveDirection = new Vector3(horizontal, 0f, vertical).normalized * cameraMoveSpeed;
transform.Translate(moveDirection * Time.deltaTime, Space.World);
}
还有这个:
private void HandleCameraMovement()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 moveDirection = new Vector3(horizontal, 0f, vertical) * cameraMoveSpeed;
transform.Translate(moveDirection * Time.deltaTime, Space.World);
}