Skip to content

Instantly share code, notes, and snippets.

@Yecats
Last active October 16, 2019 03:35
Show Gist options
  • Select an option

  • Save Yecats/7b2e18cfa71b02d11da2d980a9f839be to your computer and use it in GitHub Desktop.

Select an option

Save Yecats/7b2e18cfa71b02d11da2d980a9f839be to your computer and use it in GitHub Desktop.
Part 3
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