The constraint object serves scripting purposes. Normal objects can access their own attributes at the Scripting tab. The constraint object can access attributes of all objects that were selected at the constraint creation time. For example:
Create three spheres and create a simple animation where all the spheres move here and there.
Select the spheres
Create a constraint (pull down menu Tools/Construction/Create Constraint)
In the Spec tab of the property window, set Command Language to JavaScript and enter the script below.
if(P.y < 0)
P.y = 0;
The 'P' variable refers to the current animation channel, Translate attribute in this case.
The constraint object defines the following variables:
Target - target object. You can read any target attributes simply by calling appropriate Get method. However, you should modify target objects through the 'P' variable. This results more reusable code.
Self - constructor object itself.
Time - current time
Type - the type of the target attribute (as defined in r3typids header file)
Tag - attribute identifier, as defined in the class header file
Index - attribute inded, or -1 for regular attributes