Constraints simply involve using the position, orientation, and/or scaling of one object to drive the corresponding transformations of another object. They are very easy to set up in ICE.
Several predefined constraints are available from the ICE toolbar. To apply a predefined constraint compound:
Choose a command from the Kinematics Constrain menu of the ICE toolbar:
Orientation matches the global rotation of the constrainee to the constrainer.
Pose matches the global scaling, rotation, and translation of the constrainee to the constrainer.
Position matches the global translation of the constrainee to the constrainer.
To Closest Surface places the constrainee at the closest location on the surface of the constrainer.
Turret rotates the constrainee around one axis only to align another axis with the constrainer.
Look At rotates the constrainee so that one axis points at the constrainer, like the non-ICE Direction constraint.
Multiple ICE-based constraints are applied in order, so for example, if you want to constrain an object to another object's surface and have it point at a target then you must apply To Closest Surface first and then apply Look At.
Instead of, or in addition to, using the commands on the Kinematics Constrain menu of the ICE toolbar, you can work with the constraint compounds directly in the ICE tree. The constraint compounds are in the Kinematics category on the Tools tab of the preset manager.
Here are some basic guidelines for working with the constraint compounds in the ICE tree:
All constraint compounds must be plugged into an Add Constraints node that is connected to the root or to another execute-type port.
You can use only one Add Constraints node per constrainee per ICE tree.
You must use the same constrainee in the Add Constraints node and all attached constraint compounds. The default constrainee is "self" but you can select a different reference in the property editor, or clear it and drive it using the Constrainee In Name port.
If you want to create a custom constraint that works with the Add Constraints compound, then:
To blend with the current transform or the result of previous constraints, for example if you want to modify rotation but leave scaling and position as is, then you should base your calculations on the (constrainee).__TmpConstraintPose attribute instead of (constrainee).kine.global.
At the end of your custom constraint compound, make sure to set (constrainee).__TmpConstraintPose to the transform that you calculated. Do not set (constrainee).kine.global.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License