rinzler1989 Posted August 27, 2017 Share Posted August 27, 2017 Hi! I'm new to Babylon.js and Game Development in General. I've started a project on a dice simulation, where I generate a random dice roll result in JavaScript and visualize it as physics enabled dice being thrown and displaying the predefined result! Current status: I have a 6 sided dice object(Box) with BABYLON.DynamicTextures on them for the numbers. This object is instanced as often as needed and thrown from the same position and same rotation quaternion. My problem now is that I want to display the precalculated roll result on the dice, but as of right now it is "random". I thought I could solve this issue by rolling the dice invisible, determine with raycasts which side is up, put the textures on the right position and repeat the animation. But the problem is that as I repeat the animation the dice roll on different sides, so I can't really use this method... My question is now, is there a way to determine the outcome of a physics enabled dice movement, so I can apply the textures correctly? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 28, 2017 Share Posted August 28, 2017 Hey and welcome:) I have no good idea for you. I would probably do like you mentioned: run an invisible roll. but instead of raycasting I will just check the rotationquaternion value Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 29, 2017 Share Posted August 29, 2017 If your dice is the children of an object that has gravity, then if you set it up correctly, then the cube should always land on the bottom of the dice. Just a thought. And no, I'm not back... adam 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 29, 2017 Share Posted August 29, 2017 LOL! So welcome back?? I missed you! Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 31, 2017 Share Posted August 31, 2017 Well, maybe... Love ya DK. DB GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.