Well, but I think at first you just do something for fun and give some beginner's hint.
Printable View
Well, but I think at first you just do something for fun and give some beginner's hint.
Ok, if I were you and just do something for fun, I will do as the following.
Every instant, to record the position of the center of the dice(three float values), the velocity of its move's direction(three float values), the direction of its axis of rotation(three float values), the angular velocity of its rotation(one float value). Any time, the six vertices of the dice's postion can be caculated by the stored values. If the lowest vertex is very close the ground plane(supposing being a plane) say the distance of them is below some threshold value, then a collision detected. Making some calculation to rectify the above saved value, then to the next instant. Until the velocity of movement and angular velocity of rotation become below a threshold value, then movement of the dice ended.
Best Regards,
newbiecow
I'm very sorry to neglect to indicate storing another important float value for each instant, that is the initial angle of the dice relative to its current axis of rotation, it can be calculated through one definite point of the dice, for instance, one vertex relative to some initial vector, for instance, the cross product of the vector of the rotation axis and the outward vector, for instance.
Best Regards,
newbiecow
Of course, if you consider the friction of the surface, this simulation even becomes much harder.
But for fun, I think the above is adequate.
Best Regards,
newbiecow