# Recalculate kinematics to avoid collisions with bones

Hello everyone!

I’ve a very simple question but I haven’t found the solution anywhere.
Let’s see if you guys can give me a hand

I would like to know if in blender it’s possible to avoid collisions (for example of a tentacle) with any object, so that blender recalculates the inverse kinematics to ensure that the bones do not pass through the object.

I’ve tried using the “limit distance” modifier, but it can only be applied to the IK bone that is separated from the chain. However, when this modifier is applied to the rest of the bones, it has no effect on the rest of the bones that make up the kinematic chain.

So, how can I avoid, for example, the collision of the sphere with the rest of the bones to ensure that they are not crossed by it?

Thanks a lot.

A greeting.
Raul

Lol, that would be pretty crazy complicated, and twitchy as hell, unless you just stretched out of the way (which would be possible: chain loses deform, each chain bone gets a child with a limit distance, then you duplicate the chain with stretch-to constraints tracking those bones instead of using IK.)

If you want to avoid clipping, use physics.

For what you’re demonstrating, probably use a curve object, hooked, with softbody physics with heavy weight, applied to spline rather than mesh on the modifier options, then spline IK. Curve physics are unlikely to have the collision profile you want, so you’ll probably want the collider to represent the radius of the actual collider plus the radius of the tentacle.

I thought it wouldn’t be complicated using constraints …
My idea would be to get something similar to this video:

That video is probably doing three passes:

1. Non-deforming control bones are slightly posed
2. Non-deforming marker bones, parented to the control bones, with either limit distance constraints or shrinkwrap/outside constraints
3. Deforming layer tracks (damped track, locked track, and/or track to) these markers.

That’s okay for 2 bones, where the bones have been preposed, and you’re not doing the tough test (moving the collision body directly through the arc of the bones, or using a collision body smaller than the length of a bone.) It’s not arbitrary collision.

You can create a structure like that if you want, and then use IK to control the first, control pass of the bones. But as the number of bones increases and as you give less thought to the pre-collision, control pose, the potential for problems increases. These problems are likely to show up on interpolations rather than keyframes. You can give it a shot though if you want.

There are potential improvements, that increase complexity, but you’re never going to get real collision-- even if you create a structure that prevents bones from going through the collision body (possible with shrinkwrapping to per-bone boolean meshes), you’re just trading collision imperfection for twitch.