# c++/openGL 3D Bouncing Cube

I'm trying to write a little program with a bouncing cube but I can't find the right values for it. I have these lines:

modelMatrix = glm::mat4(1)

modelMatrix *= Translate(x, y, z)

modelMatrix *= RotateOZ(angle)



I add/sub the y in a interval and the angle too.I have a problem because I don't really know with which values to increment/sub these values.

I want the same effect as in the image but at all angles [0 - 180].

EDIT++

So I want my cube to bounce while it's rotating like in the image. First the cube will have the arrow down to show what's his position first at y0 and x0. Then he will rotate in the [0 - 90] range. I want the cube to have the arrow up meaning that the cube will be rotated at 90 angle when he will hit y1 and x1/2. Then he will start to descend at an angle [90 - 180] so he will be at y0 but with at x1. I tried incrementing the x, y and the angle with a small value like 0.1 and then decreasing the y when it hit a point. The result is close but I can see that it's not perfect. I hope that made sense.