Gamestudio Links
Zorro Links
Newest Posts
[MED] Import from FBX (2010) missing!!!
by USER0328. 09/03/26 18:03
Purchase A8 full licence version
by ukgamer. 08/30/26 14:27
ZorroGPT
by TipmyPip. 08/29/26 06:56
Retrieve optimize() variables order (edited)
by NorbertSz. 08/25/26 13:24
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
Pause button for evaluation shell?
by AndrewAMD. 08/13/26 17:16
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/26 12:46
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 1,738 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Student_64151, Koti
19230 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Good and real example of 3d dice model [Re: 3run] #460531
07/03/16 08:03
07/03/16 08:03
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I feel obliged to warn you that your dice is built wrong. Dices opposite sides always sum 7, so 1 is in front of 6, 2 of 5 and 3 of 4. The good new is that you only have to switch 2 and 6 for getting a correct dice.



Dices up value can be computed by converting a world space up vector to dices coordinates because the resulting vector will always concur with the direction and sense of one of the cartesian axes of the dice (when the table plane is horizontal!), so only one single member of the resulting vector will hold a non zero value while the other two are equal to zero. Consider aligning the three upper values of the dice (4, 5 & 6) with positive cartesian axes, so the sign of the non zero value can be used to know witch side of the two is aligned with the computed vector. Take a look to dices opposite values and you will realize the average of every pair is always 3.5, so adding each axes half range multiplied by the computed vector plus 3.5 will give you upwards value.

Here is the magic:
Code:
VECTOR vUp;
vec_set ( &vUp, vector(0, 0, 1) ); // world space up vector
vec_add ( &vUp, &ent->x ); // align to dices origin
vec_to_ent ( &vUp, ent ); // convert to dices coord system
BONE_RESULT = 3.5; // average on every axe
BONE_RESULT += sign(vUp.x) * 0.5; // 3&4 axis
BONE_RESULT += sign(vUp.y) * 1.5; // 2&5 axis
BONE_RESULT += sign(vUp.z) * 2.5; // 1&6 axis
DICE_RESULT += BONE_RESULT;



Try to understand and enjoy it!

Re: Good and real example of 3d dice model [Re: txesmi] #460533
07/03/16 09:25
07/03/16 09:25
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
i will try to study it laugh see if i can figure this out laugh

thx for the input laugh this is the first actual physical dice example in
the forum so thank you for many i think laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Good and real example of 3d dice model [Re: txesmi] #460534
07/03/16 10:11
07/03/16 10:11
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Originally Posted By: txesmi
Hi,
I feel obliged to warn you that your dice is built wrong. Dices opposite sides always sum 7, so 1 is in front of 6, 2 of 5 and 3 of 4. The good new is that you only have to switch 2 and 6 for getting a correct dice.
Thank you man, I didn't have dice bones to take a look at so I searched the web, but made that model wrong anyway grin

Originally Posted By: txesmi
Dices up value can be computed by converting a world space up vector to dices coordinates because the resulting vector will always concur with the direction and sense of one of the cartesian axes of the dice (when the table plane is horizontal!), so only one single member of the resulting vector will hold a non zero value while the other two are equal to zero. Consider aligning the three upper values of the dice (4, 5 & 6) with positive cartesian axes, so the sign of the non zero value can be used to know witch side of the two is aligned with the computed vector. Take a look to dices opposite values and you will realize the average of every pair is always 3.5, so adding each axes half range multiplied by the computed vector plus 3.5 will give you upwards value.

Here is the magic:
Code:
VECTOR vUp;
vec_set ( &vUp, vector(0, 0, 1) ); // world space up vector
vec_add ( &vUp, &ent->x ); // align to dices origin
vec_to_ent ( &vUp, ent ); // convert to dices coord system
BONE_RESULT = 3.5; // average on every axe
BONE_RESULT += sign(vUp.x) * 0.5; // 3&4 axis
BONE_RESULT += sign(vUp.y) * 1.5; // 2&5 axis
BONE_RESULT += sign(vUp.z) * 2.5; // 1&6 axis
DICE_RESULT += BONE_RESULT;



Try to understand and enjoy it!
This is indeed more elegant way to handle this! Thank you laugh I'll try to dive into this code, cause it's a bit over my head (my math sucks).

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Good and real example of 3d dice model [Re: 3run] #460535
07/03/16 10:49
07/03/16 10:49
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
I am using a dice with symbols so i had only to change the number outcomes laugh also i mad one dice roll and all till now works
figuring out the ground/plane thing in my own level as it does not
bounce yet laugh


so far so good

Fixed it all works now need to study outcome and to put it in an other variable than the example

Last edited by Realspawn; 07/03/16 10:55.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Good and real example of 3d dice model [Re: Realspawn] #460536
07/03/16 11:04
07/03/16 11:04
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
@txesmi I tried your code example, but couldn't get it to work. Did it with a single dice bone, rotated it's angles, it gives some strange results like -1.5 etc sometimes.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Good and real example of 3d dice model [Re: 3run] #460537
07/03/16 11:52
07/03/16 11:52
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I do not get troubles crazy

download

Re: Good and real example of 3d dice model [Re: txesmi] #460538
07/03/16 12:08
07/03/16 12:08
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
This is stange grin I've done probably something wrong... Going to update the link on my webpage with this demo. Thank you man.


Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Good and real example of 3d dice model [Re: 3run] #460539
07/03/16 12:24
07/03/16 12:24
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
for me is all working laugh will show clip soon laugh
i created 3 different symbol dices and all works so keep working
on this laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Good and real example of 3d dice model [Re: Realspawn] #460540
07/03/16 13:40
07/03/16 13:40

M
Malice
Unregistered
Malice
Unregistered
M



@txesmi

Very nice solution. It's like finding a constant z=1 normal regardless of the entity position. Like a sun casting light from directly above, you could modify this to determine which side of a die is most influenced by the imagined sun and which side would be fully shadowed.

That's very awesome! I wish I could think more like this and less raw mechanically.

Re: Good and real example of 3d dice model [Re: ] #460546
07/03/16 23:43
07/03/16 23:43
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
dices working awesome laugh my math skills are bad need to figure out one more thing for auto throw when runners are saved laugh

https://www.youtube.com/watch?v=Fa41p3VH-Mc&feature=youtu.be


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Page 2 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1