It’s been a while since I’ve used ICE, but on a recent project involving lots of Alembic caches I thought it would be nice to be able to augment baked geometry. In 3dsMax the attachment constraint is perfect for this, but in Softimage there isn’t really anything similar.
Needless to say I didn’t get this implemented before the project was finished, typical. Anyway, now that project is done, I’ve made an effort to finish it.
To make this work, simply add the compound to a null, link your geometry to said null. Input the link to object name, and the polygon number you want to attach to.
Note: When working with kinematics in ICE. One very helpful tip (thanks to my co worker Simon Reeves for this one) is adding a key at frame 1. So when, as is normally the case, the kinematic tree gets ‘dirty’, Softimage can then work out where the null was originally, then re-apply the ICE kinematics. This saves, removing the ICE execution, zeroing and re applying it.
This compound works on quads, and Tri meshes, normal keyframed objects, and critically for me, imported alembic geo.
How it works:
If anyone is interested in how this works, you can of course open the compound.
But in short I create all the matrix transforms in a temp pose, then apply it in one go at the end. It starts by grabbing the polygon position, this becomes the snap transform. Then I get the polygon normal, and multiply it by the matrix rotation only, of the attach object. Then using the snap location, closest location will give the point ID’s of the polygon I’m attaching to. I then use two of these to find a poly orientated axis. Cross product this axis with the polygon normal, and you get a rotation matrix.
The trickiest part was working with an ice tree on the local object and referencing another object. Once the current null moves you cannot do any more computations, as you have the attachment object global position and the null objects new location, which causes problems in the kinematic stack. So you work everything out once, then apply the kinematic once.
A big issue I found was grabbing the normal off attachment object. If you use multiply by matrix on the normal, you get a distorted normal that is pushed from the null’s zero, to the attachment object. Thanks again to Simon, I use only the matrix rotation in the multiplication, and ignore the rest.
Scale is not supported, but if you need it, it could be added easily.