Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: how to : draw & throw a dice ?

  1. #11
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Well, but I think at first you just do something for fun and give some beginner's hint.

  2. #12
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    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

  3. #13
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Quote Originally Posted by newbiecow View Post
    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

  4. #14
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •