PDA

View Full Version : Getting a 3D Dice to stop on a specific face



Victus
02-27-2017, 11:41 AM
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?

paul_g_griffiths
02-27-2017, 12:21 PM
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.

GClements
02-27-2017, 02:29 PM
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.