Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Constraints

Constraints

Milkshake
Milkshake's Dev Diary · · 2 min read
2,414 0
I've started to do some preliminary prototyping for my next project, and one of the things I need is (very basic) ragdolls. So over the next few entries we'll be following the buildup to get there.

My first thought was that, given ragdolls are pretty complex animals, that I'd have some Ragdoll controller which just did everything, and have the physics code recognise it and do ragdoll stuff. This should make it super easy to switch them on/off, as you'd just enable/disable that controller. But obviously, this is a pretty specialised solution, and doesn't get me any closer to doing similar things like rope bridges, swinging signs, bobbing pony tails, wobbly trees, etc. So I parked that for a bit, and decided I'd start off by adding support for building generic physics systems in objects - and see how this handled ragdolls before adding anything ragdoll specific.

Based on this, I've set about adding basic support for some simple constraints, starting with a ball joint. There's been a truly staggering amount of work behind the scenes to get them in (starting with re-writing the Constraint management system used for contacts to handle permanent constraints, and ending up having to re-write some nasty corners of portals and serialisation to handle serialisation of object references within other objects). But it all seems to be working now. Here's a little video of them in action. You can see that the switch is hooked up to drive the "strength" of the top constraint that attaches the block chain to the floating block, so that turning the switch on and off is like turning on a magnet.

Disabled

I added an "Elasticity" parameter to the constraint, which is why the block chain is a little bit springy. You can turn this off, but it doesn't feel quite a "fun" when they're totally instant and infinitely strong.

The next step is to extend Skeletons so you can use constraints within the bones of a skeleton ... makes me feel sick just thinking about it really.

Discussion

Loading comments...