Results 1 to 3 of 3

Thread: Getting a 3D Dice to stop on a specific face

  1. #1
    Newbie Newbie
    Join Date
    Feb 2017
    Posts
    1

    Getting a 3D Dice to stop on a specific face

    I'm currently working on a 3D simulation of a dice roll in C++, currently all I have is just a simple rotating 3D cube. I was wondering how do I take the number generated by the pesduoRNG and get the animation to stop on that specific face? Do I just create six different animations or is there a more elegant way of handling this?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2017
    Posts
    107
    Best thing I can think of is do it backwards first, starting on the correct face, then play it forward. Add in some randomisation to the start of the backwards recording and people will never know. If you apply exactly the same math then you won't even have to record it, just reverse each step.

    Or if thats too much, use bullet physics and record each step to a text file then play that back. Have to do it over and over until you have the correct 6 recordngs but people will easily work out it's a recording as the roll will be the same when that recording is repeated.
    http://strong-grip.com Strong-Grip Future Technologies.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,104
    Quote Originally Posted by Victus View Post
    I'm currently working on a 3D simulation of a dice roll in C++, currently all I have is just a simple rotating 3D cube. I was wondering how do I take the number generated by the pesduoRNG and get the animation to stop on that specific face?
    Why do you decide the dice roll from the outcome? A better solution would be to generate a random initial state (velocity and spin vectors) and let the simulation determine the final result.
    Do I just create six different animations or is there a more elegant way of handling this?
    Rigid-body physics simulation.

Similar Threads

  1. OpenGL 4+ 20sides dice in 3D
    By Loboo91 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-23-2017, 01:39 PM
  2. rotating dice
    By imported_Raymond in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-16-2016, 03:28 PM
  3. how to : draw & throw a dice ?
    By ahamedos in forum OpenGL: Basic Coding
    Replies: 13
    Last Post: 12-12-2012, 11:14 PM
  4. changing back face to front face in vertex shader
    By hoschie211 in forum OpenGL: GLSL
    Replies: 1
    Last Post: 11-03-2009, 12:36 AM
  5. Simulating a dice throw in 3D
    By Alex71 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-11-2004, 04:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean