Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:3.4

Description

Description:

Positions one object relative to another one, taking into account possible offsets or memory points.

The original orientation of either object is preserved.

The child object is only positioned at the calculated position, but is not attached.

Syntax

Syntax:[child, parent, offset, posChild, posParent, repos] call fn_vbs_positionObjectRelToObject
Parameters:
  • child: Object - Object to position.
  • parent: Object - Object that the new position is relative to.
  • offset: Vector3D - The [x,y,z] offset, relative to the parent origin, to move the child object to.
  • posChild: Vector3D or String - Either an offset to the child origin, or its memory point, to consider for the purpose of the position calculations (optional, default: origin, [0,0,0]).
  • posParent: Vector3D or String - Either an offset to the parent origin, or its memory point, to consider for the purpose of the position calculations (optional, default: origin, [0,0,0]).
  • repos: Boolean - If true, the child is repositioned at the calculated location; if false, then the new position is only calculated and returned (optional, default: true).
Return Value:PositionASL - Calculated, absolute position of child object (if repos is true, then it is positioned at that location).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Functions A-Z.

Examples

Examples:

Position object 'hat' at player memory point "head", 10cm above the default position:

[hat,player,[0,0,.1],[0,0,0],"head"] call fn_vbs_positionObjectRelToObject 

Examples of different attachments, using memory points "BR" (bottom right) and "TL" (top left):

Additional Information

See also: attachTo
Multiplayer: 
Problems: 

Notes