Global/AngleRand

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Min/max args)
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Returns an angle with a randomized pitch, yaw and roll. The pitch is between -90 and 90 degrees, while yaw and roll are between -180 and 180 degrees.
+
|Description=Returns an angle with a randomized pitch, yaw, and roll between [min, max).
 
|Realm=Shared and Menu
 
|Realm=Shared and Menu
 
|IsClass=No
 
|IsClass=No
 
|File=lua/includes/util.lua
 
|File=lua/includes/util.lua
 
|Line=104-L106
 
|Line=104-L106
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=min
 +
|default=-90 for pitch, -180 for yaw and roll
 +
|desc=Min bound inclusive.
 +
 +
{{NextUpdate}}
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=max
 +
|default=90 for pitch, 180 for yaw and roll
 +
|desc=Max bound exclusive.
 +
 +
{{NextUpdate}}
 
}}
 
}}
 
{{Ret
 
{{Ret

Revision as of 20:03, 5 June 2019

 AngleRand( )

Contents

Description

Returns an angle with a randomized pitch, yaw, and roll between [min, max).

Arguments

number min=-90 for pitch, -180 for yaw and roll

Min bound inclusive.


Next Update Change

This feature is only available in the next update.

Arguments

number max=90 for pitch, 180 for yaw and roll

Max bound exclusive.


Next Update Change

This feature is only available in the next update.

Returns

Angle

The randomly generated angle.

Examples

Example

Prints out a random angle.

print( AngleRand() )

Output:

-6.949 113.388 130.879
Personal tools
Navigation