Advertisement
Eriknem

Untitled

Sep 26th, 2020
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. private Rigidbody rb;
  2. private float movementX;
  3. private float movementY;
  4.  
  5. // Use this for initialization
  6. void Start () {
  7. rb = GetComponent<Rigidbody>();
  8. }
  9.  
  10. void OnMove(InputValue movementValue)
  11. {
  12. Vector2 movementVector = movementValue.Get<Vector2>();
  13.  
  14. movementX = movementVector.x;
  15. movementY = movementVector.y;
  16. }
  17.  
  18. // Update is called once per frame
  19. void FixedUpdate () {
  20.  
  21. Vector3 movement = new Vector3(movementX, 0.0f, movementY);
  22.  
  23. rb.AddForce (movement);
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement