Create instance variable zscale and set it to 1
Then every tick set ball.Self.zscale to ball.Self.zscale-zspeed*dt
Stationary ball would be its original size because zesale is set to 1
zspeed would be another variable, what the actual number is would depend on how hard you hit the ball. Once you get that going ball will start getting smaller and smaller simulating movement in z axis
You should make sure ball.Self.zscale never goes below 0, and not much over 1
You will also have to move the ground up as the ball gets smaller. I figured out a formula for this a while back, but I don't eremember it exactly
something like variable startground = 600
then ground = startground - (1-ball.zscale)*100 You will have to play with numbers until it looks right. In my example ball would fall down to Y of 600 when scale is at 1, then hit the ground at Y of 500 when scaled all the way to 0.1 or smaller.
Shadow Y always set to ground. Adjust shadow scale and opacity tomatch height of the ball. Higher the ball, bigger the shadow, but lower its opacity and the other way around.
Shadow X is same as ball X