Prevent Objects from Overlapping/Intersecting Automatically?

Is there a way to automatically prevent two Meshes from overlapping or intersecting in animations or does this have to be done manually?

For instance, if there is a handshake between two characters, how do you prevent the hand meshes from bleeding into each other?

I’m currently just having a character walk up a stairway, and it’s been very frustrating having to keyframe every micro-second because of the angles his feet are moving, they’re always intersecting.

Thanks as always.

Disclaimer: I’m new to Blender. :slight_smile:

I don’t think you can - how would it work? That would require Blender to automatically insert KFs to stop the meshes intersecting.

I have recently keyframed a character ascending stairs. I got the feet positioned on the treads first, then went back over the sequence and inserted KFs to ensure the feet always cleared the edges of the risers.

I appreciate the thought, cbnewham.

I’m also relatively new to Blender (well, I’ve been working on it for a year, but only in spurts here and there). But I know that you CAN animate these things by hand, but I would just like to do it automatically to (a) save a TON of time and (b) to make sure that there’s no overlapping at all.

(Funnily, even the ‘Phantom Menace’ Star Wars movie had a number of these mistakes. Check out the “Fode and Beed” screenshots here:

So! If anybody knows definitively whether there is a Collision-type technique to prevent Object overlapping, I’d be hugely appreciative.

For instance, two characters shaking hands. Do you really have to go in and manage those Meshes down at the vertex level to make sure that they never intersect? There’s no way of automating the fact that two objects can’t occupy the same space?

I don’t know if it is possible but it would certainly be very helpfull if it is possible to have collision detection in animations.

All i know is that you can assign a Collision to a cube and a Cloth to a subdivided plane and with the arrow key, move forward in frames to see the plane falling on the cube and behaving like a cloth, not moving through it.

So maybe there is then a way to prevent models to move inside of each other.

Yes, that is precisely the sort of thing that I am hoping exists for animation and general placement of objects. I believe that the Collision Physics only applies to instances where the program’s own formulas - gravity and wind and such - are in control. But if I apply a Collision to my character and the stairway and then animate them myself, the meshes do indeed still intersect.

Physics sims are of no use here. One thing you could look at is the ‘floor’ constraint, look it up in the wiki, but personally I’ve never had any luck with it. Then again, I could have been using it wrong.

For the feet passing thru the stairs problem, this is where ik (inverse kinematics) comes in very handy. Most characters you’ll find for blender will have ik for the legs and usually the arms as well. With ik, you position the foot controller and set a keyframe for it, then go about animating the rest of the body, and the foot will never move until you move the foot controller again. Really useful for walking so the feet stay stuck on the ground and the character doesn’t appear to be sliding across the floor. Here’s a video I did describing what fk & ik is, and when each one is useful…

Different methods are available for other cases. Say a character is to pick up a ball, you wouldn’t want to keyframe the location of the ball everytime the character’s hand is posed, so in a spot like this, you’d want to use a ‘child of’ constraint. Constraints influence can be keyed. So the constraint would be on the ball, and the hand bone would be the constraint’s target. The influence would be set to 0 until the character grabs the ball, then the influence would be set to 1 and keyed. On the frame before the character drops the ball, the influence would be set to 1 and keyed again, then on the next frame, the influence would be set to 0 and keyed. This is a brief explanation and lacks some details, see the attached file. If you need the finer details on how to use this, just ask, as there are a couple of tricks to getting it to work smoothly…

As to hand shaking, since you can’t have 2 armatures in pose mode at the same time and animate them together, I would use an empty and ‘child of’ constraints. At the frame where the 2 hands come together, I would use a child of constraint on each hand’s ik controller targeting the empty (which would be in between the 2 hands), then turn the constraint on and animate the empty for the up and down motions. This way each hand will move as the empty moves and appear to be connected. As to the hand meshes passing thru each other, they might, but just pose the hands so that the meshes passing thru each other isn’t visible to the camera.

Really, a big part of animation is faking it. If a hand wraps around a ball to pick it up, don’t worry about the meshes intersecting, just worry about the visible parts of the meshes intersecting. Yes, it isn’t physically correct, but if you don’t see it, does it matter?



25_ChildOf.blend (370 KB)

Thanks a lot for all the tips, Randy.

In the instance with the feet on the stairway, I’m “cheating” because I downloaded the models from here - - and then modified them to give them clothes and colors that I need. So, the IK was all set up (although it’s still very challenging and I’ll watch your tutorial, for sure.)

The feet intersecting with the stairs is still a problem - for instance, as the toes and the heels bend when moving up the stairs, they’re constantly just disappearing into the stair mesh. It’s a pain in the butt to constantly have to re-arrange everything just to keep a tiny part of the toes from disappearing for three frames, ya know?

But still, I was hoping for a universal solution that would apply to all situations like this. Two objects can’t occupy the same space at the same time in the real world, so it would seem to me that you could make this apply to the Blender world, too.

It sounds, though, like you’re an expert and if you’re unfamiliar with anything that prevents two meshes from occupying the same space at the same time, then that probably means it doesn’t exist, and I’m just gonna have to police the animations that much more closely.

I’m not a Blender or computer animation expert by any means, so I’ll admit to being an amateur when I say this. But I’m pretty startled to learn that there’s no natural way to limit objects from occupying the same space in Blender. Because this is such a basic principle of the real physical world, I’d have assumed it would also be a common feature of Blender, too.

It would SEEM to me that if Mesh’s are Manifold, then their physical space is explicit and clear. Therefore, it would seem to me to be very possible to make at least Manifold Meshes limited to their own space automatically.

I can’t write code at all and I’m not even good with Blender. But if somebody could do this, I think it would save everybody a lot of time.

None of the 3d apps, commercial or open source, do this automatically. With character animation , depending on the quality of the rig, the rigger sets a floor constraint, and a good foot setup will not push ‘through’ the floor. This is just the reality of 3d animation and 3d apps. It would actually be very frustrating for most work if (parts of) objects refused to share the same space.

That said, you could also try the snap function in Blender, and set it to “face” snapping.

And never, never, assume that the basic principles of the ‘real physical world’ are easily translatable to a computer simulated version. The seemingly simplest physical stuff is very complex to simulate well. There are always trade-offs.

*edit: Although I would love to have an option that turns object intersections “off”. That, at least should be implementable by a savvy dev. :slight_smile: Even a slow simulation would be helpful in this regard, I agree.

Thanks for that last part. I understand that modeling the real world is a fractal-like challenge of insane proportions, and I don’t take anything the great Blender developers do for granted.

But I definitely think that such an option would be tremendously helpful. Just think of the example of a handshake: If you could just tell it, “No intersecting Meshes”, that would save so much darn animating time!

Do you know how I could make this request to Blender developers?

I made a request for a feature like we’ve been discussing - I called it “Impenetrable Objects” - and posted it at this request page:

(It was kind of interesting to learn that Blender doesn’t officially take requests:

Where is the right place to request features in blender?

There are so many possible features to add to blender that its difficult to manage them usefully so we don’t accept feature requests on our tracker as some projects do.
If the feature requests are small, like an option to an existing tool you could try to contact the developer of that tool, or at least the maintainer.
See Module Owners

If you’re suggestion is a larger change, try make this a suggestion on blenderstorm and use this to get feedback, link others to it and eventually get a developer to look over it to see if its feasible.