# [Maya] Automatic Ground Collision?

#1

Hi,

I watched a Dreamwork’s rigger demonstrate a ground collission with their peacock character from Kung Fu Panda (around 26 mins).

You can check the snippet here:
https://www.dropbox.com/s/ancmbzwur7ub72m/MYA070_ground_contact.mp4?dl=0

Is there a way to do this in Maya? So far, the only ground collision I know is using dynamics (i.e nCloth/nucleus).

Nucleus system is fine but its not really real time and responsive to the animation.

Is there some sort of other rigging voodoo that does ground collision?

I was thinking of limiting the controllers (i.e. do not go past -Y coordinate) but that would be counter productive since
(1) it limits the axis orientation
(2) what happens if the character jumps where it needs a follow through (i.e. going past -Y coordinate)

Is there a way around this?

#2

what you can take a look at is the keepout nodes in the maya muscle system, they do require a geometry object to keep out from and a vector to push out to.

basic information can be found here:

#3

There is also a collision deformer that’s part of the cMuscle toolset. Keep out works with joints, but if you want to maintain a certain shape, you’ll want to use the vertex collision.

#4

cMuscle nodes are great for most cases, but for a hero effect like this, especially in pure animation, I would go for a matrix collision system. Basically, you have your collider plane (or more complex geometry) and colliding point - you keep track of the vector between the colliding point and the closest point on the geometry, and the normal on the geometry at that point. When the dot product of the two flips, you know your point has collided.

While this is more complex than a cMuscle system, it is much more controllable. It gives you an indication of how close your point is to colliding, which allows you to feather in the contact, or even establish a dynamic hierarchy of points from furthest to closest, allowing you to achieve multipoint collision as well (in theory, I’ve never actually implemented that).

The crazy part of the KP2 system is that it apparently preserves length while colliding - I would imagine you would need to project a vector along the collision surface somehow. On instinct, I think it would be easier to achieve this with a more open system as opposed to a single node.

EDIT: The above is focused only on point collision, so if you want to keep a character’s feet above the ground plane, etc. Curve collision in the example is absolutely crazy and inspirational, thanks for showing it

#5

Thanks for the responses. Apologies that it took me some time to get back. The last month was just crazy.

@peerke88
Thanks for the reference. Looks really handy. I guess it’s complicated depending on how many and how the collision looks like.

@jgaines
Yea, thanks for the mention. I guess what you mean is something like this:

@EdArt
The matrix theories is beyond my head at the moment, but by any chance, is this what you mean?

#6

Yep, that’s the kind of thing I usually do (although that full setup is only necessary if you want to orient an object to the collision surface). Usually just having a simple point collision is enough for me, so the above setup can be simplified to “Get the closest point on mesh; test if its normal is aligned with the vector from it to the collider; if it’s not, snap collision object to the point; optionally add feather behaviour by measuring the distance between them and remapping it somehow”.

I actually couldn’t get that example from KP2 out of my head once I’d seen it, so I’m working on an implementation of it right now anyway

As a side note, while the muscle-based smart collision is very impressive, and often gives the best result for bespoke meshes, you’ll also notice from the video that it’s extremely slow. For a setup like the pillow, unless I were absolutely forced not to, I would always go for point collision across a set of skinned joints; for me, the speed and control it gives you just doesn’t compare.

#7

Interesting. Thanks for the confirmation. I did a quick follow through on the Smart Collission Tutorial above but as you said it is painfully slow. But still might come in handy in some projects.

Like perhaps animating a dumpling against each other. Like this one from Pixar.