Global/Angle

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
 
Line 1: Line 1:
 
{{Func
 
{{Func
 
|Description=Creates an {{Type|Angle}} object.
 
|Description=Creates an {{Type|Angle}} object.
{{Note|This function creates a new unique object. It's a good practice to localize your colors.}}
+
{{Note|This function creates a new unique object. It's a good practice to localize your angles.}}
 
|Realm=Shared and Menu
 
|Realm=Shared and Menu
 
|IsClass=No
 
|IsClass=No

Latest revision as of 16:34, 12 January 2020

 Angle( )

Contents

Description

Creates an Angle object.

NOTE

This function creates a new unique object. It's a good practice to localize your angles.

Arguments

number pitch=0

The pitch value of the angle.
If this is an Angle, this function will return a copy of the given angle.
If this is a string, this function will try to parse the string as a angle. If it fails, it returns a 0 angle.

(See examples)

Arguments

number yaw=0

The yaw value of the angle.

Arguments

number roll=0

The roll value of the angle.

Returns

Angle

Created angle

Examples

Example

Creates an angle and prints the value to the console.

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() )

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
Personal tools
Navigation