Attaches an object to another object, either at a fixed position relative to one object (for example, always 2m in front), or using a rope to bound the two. When attaching a camera, only the first 3 parameters apply (
Note: In V1.34+, the command can be re-applied to an already attached item (with new offsets), without having to detach it first.
|Syntax:||child attachTo [parent, offset, mempoint, rope, bone, collisions]|
player attachTo [car,[0,2,0],"hatch1"]
Demo mission that attaches several boxes to a vehicle: attachTo.zip
Mission to help find attachment positions: attachToHelper.Intro.zip
|See also:||detach, isAttached, fn vbs positionObjectRelToObject, camSetAttachedLookDir, camSetBankIfAttached|
- Posted on Feb 15, 2008
- General Barron
- Positional offset is in meters, and is in the format [right, front, up]. So [-3,4,1] means the object will be attached 3m to the left, 4m in front, and 1m above the host object.
Note that this is relative to the host object's 'vectorDir' and 'vectorUpDir'! So using the previous example, if we attached an object to a plane, and that plane was flying straight up in the air, the object would be 4m higher than the plane.
Also note that you may want to adjust the attached objects orientation after issuing the attachTo command, using the setVectorUp and setVectorDir commands.
- Posted on Aug 23, 2010
- Mempoints for people are righthand, lefthand, head, neck, rightfoot, leftfoot, pelvis,...
- Posted on Feb 16, 2011
- Objects attached to GameLogics will not move along, if the GL travels along some waypoints.