Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Help with determining which side of a 3D Die is facing up.

Author
Message
Carl5163
14
Years of Service
User Offline
Joined: 21st Apr 2012
Location:
Posted: 28th May 2013 02:26
I am making a dice game where the program throws a 3d die, and I need it to figure out which side of the dice are facing up. I am using dark physics for the simulation. Thanks
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th May 2013 11:56
You can do it in many ways...what I did in my dice game was:
Imagine the dice with no rotation at all in any axis, and the number on top is for example ONE.
- If we rotate our dice 90º in x axis, our dice on top is FOUR.
- If we rotate -90º in x axis, our dice on top is SIX.

We are going to rotate the dice randomly in its three axis...
rotate object DICE ,90*RND(3),90*RND(3),90*RND(3)

So if we make all the combinations ( 6 sides by 3 axis ) we'll know which side is on top in every conbination.

Another way, perhaps easier...is to make our dice with six planes, and just check which limb is higher than...for example 3 (if your dice is let say 5*5 size ).

Now I'm out, and I don't have my code here...if you want I cand send it later.

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-07 20:23:42
Your offset time is: 2026-07-07 20:23:42