Garry's Mod Wiki

Revision Difference

Global.Angle#548979

<function name="Angle" parent="Global" type="libraryfunc"> <description>Creates an <page>Angle</page> object.</description>⤶ <description>Creates an <page>Angle</page> object. <warning>This function is very expensive when used in often running hooks or in operations requiring very frequent calls (like loops for example). It is better to store the angle in a variable or to use the [default angle](https://wiki.facepunch.com/gmod/Global_Variables#misc) available.</warning>⤶ </description>⤶ <realm>Shared and Menu</realm> <args> <arg name="pitch" type="number" default="0">The pitch value of the angle. If this is an <page>Angle</page>, this function will return a copy of the given angle. If this is a <page>string</page>, this function will try to parse the string as a angle. If it fails, it returns a 0 angle. (See examples)</arg> <arg name="yaw" type="number" default="0">The yaw value of the angle.</arg> <arg name="roll" type="number" default="0">The roll value of the angle.</arg> </args> <rets> <ret name="" type="Angle">Created angle</ret> </rets> </function> <example> <description>Creates an angle and prints the value to the console.</description> <code> print( Angle( 1, 2, 3 ) ) print( Angle( "4 5 6" ) ) local test = Angle( 7, 8, 9 ) print( Angle( test ) ) print( Angle( "4 5 test" ) ) print( Angle() ) </code> <output> ``` 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 0.00 0.00 0.00 0.00 0.00 0.00 ``` </output> </example>