Garry's Mod Wiki

Revision Difference

Vector#516962

List of all possible functions to manipulate vectors. Created by <page>Global.Vector</page>. <classfields⤶ |fields=⤶ {{classfield|number|**x** or **1**|the x component of the vector.}}⤶ {{classfield|number|**y** or **2**|the y component of the vector.}}⤶ {{classfield|number|**z** or **3**|the z component of the vector.}} <classfields>⤶ <fields>{{ClassField|number|**x** or **1**|The X component of the vector.</fields>⤶ ⤶ </classfields>⤶ ⤶ ⤶ {{ClassField|number|**y** or **2**|The Y component of the vector.}} {{ClassField|number|**z** or **3**|The Z component of the vector.}}⤶ }} {{example>⤶ <example>⤶ <description>Indexing by named component.</description> <code> local v = Vector( 1, 2, 3 ) print( v.x, v.y, v.z ) </code> <output>1 2 3</output> ⤶ </classfields⤶ |fields=⤶ {{classfield|number|**x** or **1**|the x component of the vector.}}⤶ {{classfield|number|**y** or **2**|the y component of the vector.}}⤶ {{classfield|number|**z** or **3**|the z component of the vector.}}⤶ }}⤶ {{example>⤶ ⤶ </example>⤶ <example> <description>Indexing by number (most efficient!).</description> <code> local v = Vector( 1, 2, 3 ) print( v[1], v[2], v[3] ) </code> <output>1 2 3</output> </example>