Prevent model's animations from going through itself?


I only used legacy animations unitl now.

I have some kind of complex robot arm and now I was wondering how can I make sure one part of the arm cannot pass through another part? I could check collisions and stop the animation (and only allow it to “move” in the opposite direction) by script. But before doing this I want to know if this can be done by another method.
I think it could be done using mecanim. Can mecanim help me solve this problem? What would I need to do? Setup bones?

And what is the way of doing this if not mecanim?

Sorry if the answer to this is obvious but animations other than with the legacy system are completely new to me and I hope someone can give me some basic explanation. I’m not asking for a tutorial or something, but what would be the procedure (the basic steps)?

I’m definitely not afraid of learning something new - like mecanim :slight_smile:


I don’t see any way that Mecanim could help with this. It’s just another system for changing joint rotations over time. Neither Mecanim nor Legacy have any innate knowledge of physics/collision detection (except foot/hand IK). Mecanim has lots of nice features, such as animation retargeting and built-in IK, but what you’re asking for isn’t one of them.

In Legacy, you can edit the animation so that the normal playthrough doesn’t have any body clipping. Oliver at Mixamo did a presentation on this using Unity’s Animation view window: Maybe that would be sufficient if the only problem is that the normal animation clips through the character. Otherwise I think you’re going to have to use colliders.