

Gravity needs to cancel completely the verticalVelocity at the highest point of the curve


The time between a bounce an its highest pointįloat halfBounceDur = bounceDuration / 2f Position.z = gameTime * horizontalVelocity įloat bounceDuration = bounceDistance / horizontalVelocity The ball keeps the same horizontal velocity Vector3 position // Your input code, I suggest looking up Mathf.SmoothDamp for smoothing This solves the second problem, but not the first. You could also implement a basic physics engine for your ball on Update instead of FixedUpdate, by reducing the y velocity by gravity every frame, and adding the velocity to the position every frame too. You would also have the Unity usual problem of the ball’s motion being jerky because the fixed framerate is different than the render framerate. The problem is that any error would accumulate, and you would risk missing the platform after a while. The first solution would be a rigidbody with gravity enabled, making the physics material drag 0 and bounciness 1, and calculating the vertical velocity of your parabola using a ballistic calculator. There are plenty of ways to do that in Unity: You basically want your ball position to do three things: * z increases linearly
