- #1

- 7

- 0

ok so im programming a program that starts with a ball in the air and it will automatically start to fall here is a simplified look at my code to see where im going wrong etc...i want help not just the answer as i will need to apply this with other objects in the future

ok:

speed = 9.8 * (Mathf.Pow(Time.time,2))

the ball position then drops in the y axis due to -speed

when it hits the floor i do the following calculations

downVelocity = Mathf.Sqrt((2 * (9.8 * startingHeight)))

newVelocity = COR * downVelocity

nextBounceHeight = (Mathf.Pow(newVelocity ,newVelocity )) / (2 * 9.8);

and then to send the ball back up i change the -speed to just speed

now my problems i am getting are:

the speed of when it falls is the same as when it bounces in air, surely im missing something that takes away the newvelocity? and then also looking at this the downVelocity will always be the same surely that isnt right?