attachTo (VBS2)
From Bohemia Interactive Community
| Editors, please check Policy: Scripting Command Page Syntax. |
Click on the images for descriptions
Introduced in
- Game:
- Virtual Battlespace 2
- Version:
- 1.00
Description
- Description:
- Attaches an object to another object, either at a fixed position relative to one object (eg: always 2m in front), or using a rope to bound the two.
Syntax
- Syntax:
- obj1 attachTo [obj2,offset,mempoint,rope]
- Parameters:
- obj1: Object - object to be attached
- obj2: Object - object that obj1 is being attached to
- offset: Position3D - positional offset to either the object center or the memory point (optional). If no offset value is specified, the object is attached with the current position it's placed at.
- mempoint: String - obj2's memory point (optional)
- rope: Boolean - (optional) If true (or 1), the attachment will be done via a flexible rope, allowing obj1 to swing about.
If set to 2, the object will be attached via an inflexible link (like a hook).
If the model has a memory point "attachRope" then the rope will be attached to this point. - Return Value:
- Nothing
Examples
- Example 1:
player attachTo [car,[0,2,0],"hatch1"]
Additional Information
- Multiplayer:
- Only has to be executed on one client.
- See also:
- detach, isAttached
Notes
Notes
Notes
-
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.
--General Barron 00:21, 15 February 2008 (CET)

