‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
math_shared.gsc File Reference

Go to the source code of this file.

Functions

function angle_dif (oldangle, newangle)
 
function array_average (array)
 
function array_std_deviation (array, mean)
 
function clamp (val, val_min, val_max)
 
function closest_point_on_line (point, lineStart, lineEnd)
 
function cointoss ()
 
function expand_maxs (maxs, point)
 
function expand_mins (mins, point)
 
function find_box_center (mins, maxs)
 
function get_2d_yaw (start, end)
 
function get_dot_direction (v_point, b_ignore_z, b_normalize, str_direction, b_use_eye)
 
function get_dot_forward (v_point, b_ignore_z, b_normalize)
 
function get_dot_from_eye (v_point, b_ignore_z, b_normalize, str_direction)
 
function get_dot_right (v_point, b_ignore_z, b_normalize)
 
function get_dot_up (v_point, b_ignore_z, b_normalize)
 
function lag (desired, curr, k, dt)
 
function linear_map (num, min_a, max_a, min_b, max_b)
 
function pow (base, exp)
 
function random_normal_distribution (mean, std_deviation, lower_bound, upper_bound)
 
function random_vector (max_length)
 
function randomSign ()
 
function sign (x)
 
function vec_to_angles (vector)
 
function vector_compare (vec1, vec2)
 

Function Documentation

◆ angle_dif()

function angle_dif ( oldangle  ,
newangle   
)

Definition at line 157 of file math_shared.gsc.

◆ array_average()

function array_average ( array  )

Description:
"Function Name: array_average( <array> )"
"Summary: Given an array of numbers, returns the average (mean) value of the array" "Module: Utility"
"Mandatory Argument(s): <array>: the array of numbers which will be averaged"
"Example:array_average( numbers );"
"Single Player / Multi Player: both"

Definition at line 397 of file math_shared.gsc.

References array.

◆ array_std_deviation()

function array_std_deviation ( array  ,
mean   
)

Description:
"Function Name: array_std_deviation( <array>, <mean> )"
"Summary: Given an array of numbers and the average of the array, returns the standard deviation value of the array" "Module: Utility"
"Mandatory Argument(s): <array>: the array of numbers"
"Mandatory Argument(s): <mean>: the average (mean) value of the array"
"Example:array_std_deviation( numbers, avg );"
"Single Player / Multi Player: both"

Definition at line 422 of file math_shared.gsc.

References array.

◆ clamp()

function clamp ( val  ,
val_min  ,
val_max   
)

Description:
"Function Name: clamp(val, val_min, val_max)"
"Summary: Clamps a value between a min and max value." "Module: Math"
"Mandatory Argument(s): val: the value to clamp."
"Mandatory Argument(s): val_min: the min value to clamp to."
"Mandatory Argument(s): val_max: the mac value to clamp to."
"Example:clamped_val = clamp(8, 0, 5); // returns 5 * clamped_val = clamp(-1, 0, 5); // returns 0"
"Single Player / Multi Player: both"

Definition at line 23 of file math_shared.gsc.

References DEFAULT.

Referenced by linear_map().

◆ closest_point_on_line()

function closest_point_on_line ( point  ,
lineStart  ,
lineEnd   
)

Definition at line 491 of file math_shared.gsc.

Referenced by crossesNoFlyZone(), crossesNoFlyZones(), and getNoFlyZoneHeightCrossed().

◆ cointoss()

function cointoss ( )

Definition at line 7 of file math_shared.gsc.

◆ expand_maxs()

function expand_maxs ( maxs  ,
point   
)

Definition at line 114 of file math_shared.gsc.

Referenced by calculate_map_center(), and onStartGameType().

◆ expand_mins()

function expand_mins ( mins  ,
point   
)

Definition at line 94 of file math_shared.gsc.

Referenced by calculate_map_center(), and onStartGameType().

◆ find_box_center()

function find_box_center ( mins  ,
maxs   
)

◆ get_2d_yaw()

function get_2d_yaw ( start  ,
end   
)

Definition at line 516 of file math_shared.gsc.

References end(), and vec_to_angles().

Referenced by turret_target_check(), and updateTargetYaw().

◆ get_dot_direction()

function get_dot_direction ( v_point  ,
b_ignore_z  ,
b_normalize  ,
str_direction  ,
b_use_eye   
)

Description:
"Function Name: get_dot_direction( <v_point>, [b_ignore_z], [b_normalize], [str_direction], [ b_use_eye] )"
"Summary: Calculates and returns dot between an entity's directional vector and a point." "Module: Math" "CallOn: Entity. Must have origin and angles parameters."
"Mandatory Argument(s): <v_point> vector position to check against entity origin and angles"
"Optional Argument(s): <b_ignore_z> specify if get_dot should consider 2d or 3d dot. Defaults to false for 3d dot."
"Optional Argument(s): <str_direction> specify which vector type to use on angles. Valid options are "forward", "backward", "right", "left", "up" and "down". Defaults to "forward"."
"Optional Argument(s): <b_normalize> specify if the function should normalize the vector to target point. Defaults to true."
"Optional Argument(s): <b_use_eye> if self a player or AI, use tag_eye rather than .angles. Defaults to true on players, defaults to false on everything else. <br/>"Example:n_dot = player get_dot_direction( woods.origin );" <br/>"Single Player / Multi Player: singleplayer"

Definition at line 198 of file math_shared.gsc.

References get_eye().

Referenced by get_dot_forward(), get_dot_from_eye(), get_dot_right(), get_dot_up(), and is_looking_at().

◆ get_dot_forward()

function get_dot_forward ( v_point  ,
b_ignore_z  ,
b_normalize   
)

Description:
"Function Name: get_dot_forward( <v_point>, [b_ignore_z], [b_normalize] )"
"Summary: Calculates and returns dot between an entity's forward vector and a point." "Module: Math" "CallOn: Entity. Must have origin and angles parameters."
"Mandatory Argument(s): <v_point> vector position to check against entity origin and angles"
"Optional Argument(s): <b_ignore_z> specify if get_dot should consider 2d or 3d dot. Defaults to false for 3d dot."
"Optional Argument(s): <b_normalize> specify if the function should normalize the vector to target point. Defaults to true."
"Example:n_dot = player get_dot_direction( woods.origin );"
"Single Player / Multi Player: singleplayer"

Definition at line 351 of file math_shared.gsc.

References get_dot_direction().

◆ get_dot_from_eye()

function get_dot_from_eye ( v_point  ,
b_ignore_z  ,
b_normalize  ,
str_direction   
)

Description:
"Function Name: get_dot_from_eye( <v_point>, [b_ignore_z], [b_normalize], [str_direction] )"
"Summary: Calculates and returns dot between an entity's forward vector and a point based on tag_eye. Only use on players or AI" "Module: Math" "CallOn: Entity. Must have origin and angles parameters."
"Mandatory Argument(s): <v_point> vector position to check against entity origin and angles"
"Optional Argument(s): [b_ignore_z] specify if get_dot should consider 2d or 3d dot. Defaults to false for 3d dot."
"Optional Argument(s): [b_normalize] specify if the function should normalize the vector to target point. Defaults to true."
"Optional Argument(s): [str_direction] specify which vector type to use on angles. Valid options are "forward", "backward", "right", "left", "up" and "down". Defaults to "forward"."
"Example:n_dot = player get_dot_from_eye( woods.origin );"
"Single Player / Multi Player: singleplayer"

Definition at line 374 of file math_shared.gsc.

References get_dot_direction().

◆ get_dot_right()

function get_dot_right ( v_point  ,
b_ignore_z  ,
b_normalize   
)

Description:
"Function Name: get_dot_right( <v_point>, [b_ignore_z], [b_normalize] )"
"Summary: Calculates and returns dot between an entity's right vector and a point." "Module: Math" "CallOn: Entity. Must have origin and angles parameters."
"Mandatory Argument(s): <v_point> vector position to check against entity origin and angles"
"Optional Argument(s): <b_ignore_z> specify if get_dot should consider 2d or 3d dot. Defaults to false for 3d dot."
"Optional Argument(s): <b_normalize> specify if the function should normalize the vector to target point. Defaults to true."
"Example:n_dot = player get_dot_direction( woods.origin );"
"Single Player / Multi Player: singleplayer"

Definition at line 307 of file math_shared.gsc.

References get_dot_direction().

◆ get_dot_up()

function get_dot_up ( v_point  ,
b_ignore_z  ,
b_normalize   
)

Description:
"Function Name: get_dot_up( <v_point>, [b_ignore_z], [b_normalize] )"
"Summary: Calculates and returns dot between an entity's up vector and a point." "Module: Math" "CallOn: Entity. Must have origin and angles parameters."
"Mandatory Argument(s): <v_point> vector position to check against entity origin and angles"
"Optional Argument(s): <b_ignore_z> specify if get_dot should consider 2d or 3d dot. Defaults to false for 3d dot."
"Optional Argument(s): <b_normalize> specify if the function should normalize the vector to target point. Defaults to true."
"Example:n_dot = player get_dot_direction( woods.origin );"
"Single Player / Multi Player: singleplayer"

Definition at line 329 of file math_shared.gsc.

References get_dot_direction().

◆ lag()

function lag ( desired  ,
curr  ,
,
dt   
)

Description:
"Function Name: lag(desired, curr, k, dt)"
"Summary: Changes a value from current to desired using 1st order differential lag." "Module: Math"
"Mandatory Argument(s): desired: desired value."
"Mandatory Argument(s): curr: the current value."
"Mandatory Argument(s): k: the strength of the lag ( lower = slower, higher = faster)."
"Mandatory Argument(s): dt: time step to lag over ( usually 1 server frame )."
"Example:speed = lag(max_speed, speed, 1, 0.05);"
"Single Player / Multi Player: both"

Definition at line 69 of file math_shared.gsc.

◆ linear_map()

function linear_map ( num  ,
min_a  ,
max_a  ,
min_b  ,
max_b   
)

Description:
"Function Name: linear_map(val, min_a, max_a, min_b, max_b)"
"Summary: Maps a value within one range to a value in another range." "Module: Math"
"Mandatory Argument(s): val: the value to map."
"Mandatory Argument(s): min_a: the min value of the range in which <val> exists."
"Mandatory Argument(s): max_a: the max value of the range in which <val> exists."
"Mandatory Argument(s): min_b: the min value of the range in which the return value should exist."
"Mandatory Argument(s): max_b: the max value of the range in which the return value should exist."
"Example:fov = linear_map(speed, min_speed, max_speed, min_fov, max_fov);"
"Single Player / Multi Player: both"

Definition at line 52 of file math_shared.gsc.

References clamp().

◆ pow()

◆ random_normal_distribution()

function random_normal_distribution ( mean  ,
std_deviation  ,
lower_bound  ,
upper_bound   
)

Description:
"Function Name: random_normal_distribution( <mean>, <std_deviation>, <lower_bound>, <upper_bound> )"
"Summary: Given the mean and std deviation of a set of numbers, returns a random number from the normal distribution" "Module: Utility"
"Mandatory Argument(s): <mean>: the average (mean) value of the array"
"Mandatory Argument(s): <std_deviation>: the standard deviation value of the array"
"Optional Argument(s): <lower_bound> the minimum value that will be returned"
"Optional Argument(s): <upper_bound> the maximum value that will be returned"
"Example:random_normal_distribution( avg, std_deviation );"
"Single Player / Multi Player: both"

Definition at line 454 of file math_shared.gsc.

Referenced by set_rank().

◆ random_vector()

function random_vector ( max_length  )

Definition at line 152 of file math_shared.gsc.

◆ randomSign()

function randomSign ( )

Definition at line 179 of file math_shared.gsc.

Referenced by drone_pain(), hunter_frontScanning(), and state_emped_update().

◆ sign()

function sign ( )

Definition at line 174 of file math_shared.gsc.

◆ vec_to_angles()

function vec_to_angles ( vector  )

Definition at line 523 of file math_shared.gsc.

Referenced by get_2d_yaw().

◆ vector_compare()

function vector_compare ( vec1  ,
vec2   
)

Description:
"Function Name: vector_compare( <vec1>, <vec2> )"
"Summary: For 3D vectors. Returns true if the vectors are the same"
"Mandatory Argument(s): <vec1> : A 3D vector (origin)"
"Mandatory Argument(s): <vec2> : A 3D vector (origin)"
"Example:if (vector_compare(self.origin, node.origin){print(\"yay, i'm on the node!");}" <br/>"Single Player / Multi Player: both"

Definition at line 147 of file math_shared.gsc.