Tags

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

‘A simple joint?’ Arkwood sniffed. He licked the Rizla paper. ‘Simple, maybe. But then, all God’s creations are.’

Poet? Snakes like cables to him.

‘No, you pathetic slimebag. A physics simple distance joint. You know, a point to point constraint between two rigid bodies.’

Arkwood shook his head, bottom lip as a camel. ‘Nah, don’t talk to me about rigid bodies, man. Still shook up with that corpse under the cooker.’

No use. So I cranked open my C++ Microsoft Visual Studio application (with OpenGL and the Oculus SDK for Windows) and implemented some Bullet physics.

Armed with the Simple Distance Joint tutorial I put on the Oculus Rift virtual reality headset and tried to punch my way through a cube that blocked my path:

No good. That red cube wedged between the walls is stopping me from getting to the other side of the room.

It’s my own fault really, as I have implemented Bullet physics: player collision to prevent me from walking through physics objects.

But what is that I spy with a monocled eye? A switch, which I can slam with my fist. And when I do, I dynamically add a point to point constraint – simple distance joint, if you will – between the red cube and a blue cube that is hovering above it.

Adding a constraint dynamically is under discussion – for me, I simply removed the existing rigid bodies for the cubes from my physics world, and then readded them with the constraint.

And as a nice touch, I positioned a switch sound at the red cube, courtesy of Rutger Muller on Freesound. I used FMOD to play the 3D audio.

So, with the simple distance joint added, the dynamic red cube springs up to the static blue cube and my path across to the other side of the room is unblocked. I can continue my quest through the virtual world.

‘Nice use of a joint, man,’ Arkwood slurred. His eyes were spinning and dilating.

I snatched the weedy stick out of his skeletal paw.

‘This,’ I exclaimed, holding the spliff aloft in puritan triumph, ‘is not God’s simple creation. It is a synthetic mockery!’

Arkwood snapped back, ‘That’s where you are wrong! It’s so… soooo…’ and his head slumped on the sofa, snoozing.

‘What a fraud,’ I scoffed, and took a long hearty draw.

Advertisements