Re: Physics Patch-a-Day Thread – Join the fun!!!
Today’s PAD shows two different ways to do the same type of thing, create a 3D simulation of a snake erratically twitching about in a zero gravity environment, just the thing that everyone needs more of in their life!
The first method involves connecting a bunch of gridshape/body pairs with 6dof constraints, and driving them with impulses for movement and torque. This method is perhaps more descriptive of what is going on, but it also gets a little cumbersome to patch together all of these objects.
As I was building this version, Rob R. pointed out that you could do something similar with jit.phys.multiple. In addition, you can create a snake-like form by using jit.gl.path, and a "head" to the snake with another gridshape that is being driven by the rotation and position matricies from the phys.multiple object. In addition, using a two-level jit.anim.node hierarchy allows for an offset for the "head" position.
There are some interesting differences in both simulations, and both have their advantages and disadvantages. But, it helped me understand a few features I hadn’t played with before. It gets really fun when you add a few more snakes to the pit and see how they interact. I’ve placed a jit.phys.picker object in the patch so you can toss around the snakes too.
Extra credit: how would you add a "tail" to the phys.multiple snake? How would you include the "head" to be part of the rest of the physics body?