Jump to content

Simulate outcome of physics object movement


rinzler1989
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...