Last active
October 16, 2019 03:35
-
-
Save Yecats/7b2e18cfa71b02d11da2d980a9f839be to your computer and use it in GitHub Desktop.
Part 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void OnMove(InputAction.CallbackContext context) | |
| { | |
| //Read the input value | |
| Vector2 value = context.ReadValue<Vector2>(); | |
| //Store the value as a Vector3, making sure to move the Y input on the Z axis. | |
| _moveDirection = new Vector3(value.x, 0, value.y); | |
| } | |
| private void FixedUpdate() | |
| { | |
| //Sets the move target position based on the move direction. Must be done here as there's no logic for the input system to calculate holding down an input | |
| _moveTarget += (CameraRig.transform.forward * _moveDirection.z + CameraRig.transform.right * _moveDirection.x) * Time.fixedDeltaTime * _internalMoveTargetSpeed; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment