Bullet physics: restitution


, , , , , , , , , , , , ,

Arkwood held his police records aloft and said, ‘Every action has a reaction.’

I threw my chopsticks in the air, ‘Of course!’

I cranked open my C++ Microsoft Visual Studio application (with OpenGL graphics library and the Oculus SDK for Windows) and added some bounce to my ball.

Here’s a video of the large red ball bouncing on a table in my virtual world:

Let me take off the Oculus Rift virtual reality headset and explain…

It’s all thanks to Bullet Real-Time Physics Simulation. I extended the code from my post Bullet physics in VR, to set restitution to the ground and ball:


And I adjusted my ground state so that the ball would bounce on the table, rather than crash through it and hit the floor:

btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, -0.15, 0)));

Stack exchange has some discussion on the restitution values, which needs further delving.

But for now, the ball it bounces.

Arkwood tried to bounce his dirty records out of the window. But the restitution of his crimes stuck to him like glue.