Software: Away3D 4.x

tcorbet, Jr. Member
Posted: 25 January 2012 06:28 PM   Total Posts: 31

I have been trying to simulate the rolling of dice [normal, 6-sided for now, but variations of the application might use non-cubic dice].  For several reasons, the die need to be ‘rounded’—the three in the middle of the image in the “Construction” paragraph of the Wikipedia page [] nicely shows a smaller version of what I am using.

So, while there is so much about the use of AwayPhysics that I have yet to be able to understand, my testing and reading of the documentation and tutorials led me to the conclusion that I would likely get a better result if, instead of using a BoxShape, I tried a MultiSphereShape.

I have made the modifications to the AwayPhysics library to add an AWPMultiSphereShape class.  Preliminary testing is giving me a better visual appearance of the way I think dice should behave, but perhaps it is just that by trial and error I have stumbled upon a better set of property values and applications of impulses which, could have been applied to a simpler BoxShape with equivalent results.

In any case, I believe that including a port of btMultiSphereShape in the AwayPhysica library would be of real value for many more uses than just simulating rolling dice.  I will be happy to send along the code that I used to implement my version.  Of course, you will know that it is rather simple to do, so you could do a better and more complete job than I did.  [I did not define a new AWPCollisionShapeType nor implement a draw method for the AWPDebugDraw class.]


loth, Sr. Member
Posted: 09 March 2012 01:09 AM   Total Posts: 236   [ # 1 ]

maybe you can use AWPCompoundShape
if you don’t need many dice



Away3D Forum

Member Login