Help me achieve more realism with my dice?
Posted: Tue Feb 21, 2012 2:41 pm
Hi all,
I've been working on this for the past week or two (and gotten some great help from these forums) and it's coming along great. Now I'd like to see if I can get some more help simulating a more realistic dice rolling experience. Here's a video of what my application currently looks like:
http://youtu.be/C8uspW9DyRE
(sorry for the quality - i had to record it using FaceTime on my Mac)
As you can see, the dice don't bounce around like real dice do. If you were to drop a real die on a table, it would bounce, spin vigorously, and eventually settle. Mine will bounce around the screen but won't bounce vigorously off the ground, and they also settle too fast. I've played around with the restitution of the dice and the ground, set damping of dice to (0,0), and scaled the gravity to -496.63 (because normal dice are 16mm, and I had to make the dice in my app 0.80m to match the size of their respective graphic POD files: (0.8 / .016) * 9.81 = ~496).
What I'd like to see is the dice hit the ground, bounce up a little and spin, and then hit the ground again and roll a couple times before coming to a complete halt. Here are a couple of the values I'm using:
groundRigidBody: restitution:0.3, friction:0.7
diceRigidBody: restitution:1.2, friction:0.35 (I know the restitution is high but any lower and the dice barely bounce at all)
This is my shakeDevice method. I generate random values for the impulse on the Y and Z axes to make each die bounce around differently:
Would anyone be able to offer a suggestion to get more realistic dice than I currently have?
Thanks!
Anthony
I've been working on this for the past week or two (and gotten some great help from these forums) and it's coming along great. Now I'd like to see if I can get some more help simulating a more realistic dice rolling experience. Here's a video of what my application currently looks like:
http://youtu.be/C8uspW9DyRE
(sorry for the quality - i had to record it using FaceTime on my Mac)
As you can see, the dice don't bounce around like real dice do. If you were to drop a real die on a table, it would bounce, spin vigorously, and eventually settle. Mine will bounce around the screen but won't bounce vigorously off the ground, and they also settle too fast. I've played around with the restitution of the dice and the ground, set damping of dice to (0,0), and scaled the gravity to -496.63 (because normal dice are 16mm, and I had to make the dice in my app 0.80m to match the size of their respective graphic POD files: (0.8 / .016) * 9.81 = ~496).
What I'd like to see is the dice hit the ground, bounce up a little and spin, and then hit the ground again and roll a couple times before coming to a complete halt. Here are a couple of the values I'm using:
groundRigidBody: restitution:0.3, friction:0.7
diceRigidBody: restitution:1.2, friction:0.35 (I know the restitution is high but any lower and the dice barely bounce at all)
This is my shakeDevice method. I generate random values for the impulse on the Y and Z axes to make each die bounce around differently:
Code: Select all
-(void)shakeDevice:(int)whichDie
{
switch (whichDie) {
case 1:
shakeDie = dieRigidBody;
break;
case 2:
shakeDie = die2RigidBody;
break;
case 3:
shakeDie = die3RigidBody;
break;
default:
break;
}
if (left)
{
shakeDie->applyImpulse(btVector3(70,[self randomNumberWithLowValue:30.0 highValue:40.0],[self randomNumberWithLowValue:50.0 highValue:70.0]), btVector3([self randomNumberWithLowValue:-1.0 highValue:1.0], [self randomNumberWithLowValue:-1.0 highValue:1.0], [self randomNumberWithLowValue:-1.0 highValue:1.0]));
left = NO;
} else {
shakeDie->applyImpulse(btVector3(-70,-([self randomNumberWithLowValue:30.0 highValue:40.0]),[self randomNumberWithLowValue:50.0 highValue:70.0]), btVector3([self randomNumberWithLowValue:-1.0 highValue:1.0], [self randomNumberWithLowValue:-1.0 highValue:1.0], [self randomNumberWithLowValue:-1.0 highValue:1.0] ));
left = YES;
}
}
Thanks!
Anthony