The placeat function will place an object at the location of another object in the scene. We have a scene with this hierarchic setup:

In this case the object "Child" will be placed at the location of "Object"
Child.Position = placeat( Child.Position, Object.Position );
The function takes into account the offset that the object has from its parent. The child object will always stick at the same place in world space as the Object no matter if you move Parent, or Object.
Get example project placeat_01.prj
You can place an object within a hierarchy to another object in another hierarchy by using the coord() function for the second argument:

In this case we want to constrain the position of Child_1 to the position of Child_2. We need the coord function to get the absolute world position of Child_2:
Child_1.Position = placeat( Child_1.Position, coord( Child_2.Position ));
Get example project placeat_02.prj
|