Plot and animate a 3D Dice Image

5 views (last 30 days)
Alex Burton
Alex Burton on 13 Apr 2015
Edited: pfb on 13 Apr 2015
I am building a simple dice simulator. User inputs #of sides, dice, rolls, and a random number generator (randi()) outputs a value or values.
Part of the requirement of the program is that there needs to be some sort of visualization. I know it is possible to plot a 3d cube/pyramid/etc, but is there any way to plot the shape with the resulting number from the generator printed on the side? If that is possible, is there any way to give the object a simple animation, like make it spin a few times before stopping and showing the value?
I know this is a long shot, but any advice you can provide would be extremely appreciated.
Thanks!

Answers (1)

pfb
pfb on 13 Apr 2015
Edited: pfb on 13 Apr 2015
perhaps placing dots (circles) instead of numbers on the faces of the dice is easier, at least for a traditional cubic dice. That would work also for a tetrahedron (even less dots). But if you plan a dice with many faces that becomes unpractical, readability-wise. Hard to tell apart 23 dots from 21.
I'd prepare the data for the faces of the dices and the relevant dots to be rendered using fill3. Then you can rotate them to build an animation.
Or else, you could rotate the point of view (setting the axes off).

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!