Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void FixedUpdate ()
  2. {
  3.  
  4. transform.Translate(Vector3.up * currentSpeed * Time.deltaTime);
  5. float newManeuver = Mathf.MoveTowards (rb.velocity.x, targetManeuver, Time.deltaTime * smoothing);
  6. rb.velocity = new Vector3 (newManeuver, 0.0f, currentSpeed);
  7. rb.position = new Vector3
  8. (
  9. Mathf.Clamp (rb.position.x, -1.88f, 2.5f), -----> -1.88 is the x value where the ball is supposed to stop, and its in fact stopping there, but this value changes, i suppose, depending on the resolution
  10.  
  11. Mathf.Clamp (rb.position.y, -8f, 7f),
  12. 0.0f
  13. );
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement