All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyCommon.plyUtil Class Reference

Utility class. More...

Public Types

enum  EasingType {
  Step, Linear, Sine, Quadratic,
  Cubic, Quartic, Quintic
}
 

Static Public Member Functions

static string GetMd5Hash (string input, MD5 md5)
 Gets md5 hash for input string. More...
 
static bool VerifyMd5Hash (string input, string hash)
 Verify md5 hash. More...
 
static Vector3 PickPointInCircle (float radius)
 will pick a random 2D point within 2D circle of radius and return the values as [x, 0, z]. More...
 
static Vector3 PickPointInRectanle (Vector2 wh)
 will pick a random 2D point within 2D rectangle and return the values as [x, 0, z]. More...
 
static float AngleSigned (Vector3 v1, Vector3 v2, Vector3 n)
 Determine the signed angle between two vectors, with normal 'n' as the rotation axis. More...
 
static Vector3[] RotatedRectangle (Vector3 p, Vector2 wh, float angle)
 Return vertex points of rectangle rotated around position, on XZ plane More...
 
static Vector3 PointInRotatedRectangle (Vector2 wh, float angle)
 Return random point in rotated rectangle, on XZ plane More...
 
static float ClampAngle (float angle, float min, float max)
 
static bool IsInRange (Transform tr, Vector3 pos, float checkDistance, int checkAngle)
 Is pos in range of TR and is TR facing in a direction within checkAngle towards pos? More...
 
static bool FacingInRange (Transform tr, Vector3 facePos, float range)
 Return True if TR's forward face is within a certain range towards facePos The Dot product is used to determine this so range should be a value between -1 and +1. 1 = 0* 0.866 = 30* 0.7071 = 45* 0.5 = 60* 0 = 90* -0.5 = 120* -0.701 = 135* -0.866 = 150* -1 = 180* For more information on the value that can be used check https://docs.unity3d.com/Documentation/Manual/UnderstandingVectorArithmetic.html More...
 
static bool FacingInRange (Transform tr, Vector3 facePos, int angle)
 Return True if TR's forward face is within a certain angle towards facePos More...
 
static List< T > CleanupList< T > (List< T > list)
 Runs through and remove all null values from the list of UnityEngine.Object objects. More...
 
static bool EnDisableComponent (Component c, bool en)
 Enable/ Disable the component. Component does not actually have an "enabled" property so this function try to cast it to types that might, like Behaviour and Collider. Returns False if it did not manage to set the enabled state. More...
 
static void GizmoDrawArc (Vector3 center, Vector3 forward, float angle, float radius)
 Draw a wire arc around World.Up. More...
 

Detailed Description

Utility class.

Member Function Documentation

static float plyCommon.plyUtil.AngleSigned ( Vector3  v1,
Vector3  v2,
Vector3  n 
)
static

Determine the signed angle between two vectors, with normal 'n' as the rotation axis.

Parameters
v1Face Direction.
v2Direction to target.
nThe normal Vector.
Returns
The angle.
static List<T> plyCommon.plyUtil.CleanupList< T > ( List< T >  list)
static

Runs through and remove all null values from the list of UnityEngine.Object objects.

Template Parameters
TGeneric type parameter. UnityEngine.Object
Parameters
listThe list.
Returns
Cleaned up list.
Type Constraints
T :UnityEngine.Object 
static bool plyCommon.plyUtil.EnDisableComponent ( Component  c,
bool  en 
)
static

Enable/ Disable the component. Component does not actually have an "enabled" property so this function try to cast it to types that might, like Behaviour and Collider. Returns False if it did not manage to set the enabled state.

static bool plyCommon.plyUtil.FacingInRange ( Transform  tr,
Vector3  facePos,
float  range 
)
static

Return True if TR's forward face is within a certain range towards facePos The Dot product is used to determine this so range should be a value between -1 and +1. 1 = 0* 0.866 = 30* 0.7071 = 45* 0.5 = 60* 0 = 90* -0.5 = 120* -0.701 = 135* -0.866 = 150* -1 = 180* For more information on the value that can be used check https://docs.unity3d.com/Documentation/Manual/UnderstandingVectorArithmetic.html

static bool plyCommon.plyUtil.FacingInRange ( Transform  tr,
Vector3  facePos,
int  angle 
)
static

Return True if TR's forward face is within a certain angle towards facePos

static string plyCommon.plyUtil.GetMd5Hash ( string  input,
MD5  md5 
)
static

Gets md5 hash for input string.

Parameters
inputThe input string.
md5The fifth md5 object to use.
Returns
The md5 hash.
static void plyCommon.plyUtil.GizmoDrawArc ( Vector3  center,
Vector3  forward,
float  angle,
float  radius 
)
static

Draw a wire arc around World.Up.

Parameters
centerThe center point/ position.
forwardThe forward vector of the arc.
angleThe angle in degrees.
radiusThe radius of the circle.
static bool plyCommon.plyUtil.IsInRange ( Transform  tr,
Vector3  pos,
float  checkDistance,
int  checkAngle 
)
static

Is pos in range of TR and is TR facing in a direction within checkAngle towards pos?

static Vector3 plyCommon.plyUtil.PickPointInCircle ( float  radius)
static

will pick a random 2D point within 2D circle of radius and return the values as [x, 0, z].

Parameters
radiusThe radius of the circle.
Returns
A Vector3.
static Vector3 plyCommon.plyUtil.PickPointInRectanle ( Vector2  wh)
static

will pick a random 2D point within 2D rectangle and return the values as [x, 0, z].

Parameters
whThe width and height of the rectangle.
Returns
A Vector3.
static Vector3 plyCommon.plyUtil.PointInRotatedRectangle ( Vector2  wh,
float  angle 
)
static

Return random point in rotated rectangle, on XZ plane

Parameters
whwidth and height
angleangle in degrees
Returns
static Vector3 [] plyCommon.plyUtil.RotatedRectangle ( Vector3  p,
Vector2  wh,
float  angle 
)
static

Return vertex points of rectangle rotated around position, on XZ plane

Parameters
pposition
whwidth and height
angleangle in degrees
Returns
static bool plyCommon.plyUtil.VerifyMd5Hash ( string  input,
string  hash 
)
static

Verify md5 hash.

Parameters
inputThe input string.
hashThe known hash.
Returns
true if it succeeds, false if it fails.