SHARE
TWEET

Untitled

a guest Mar 20th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top