![](https://static.wixstatic.com/media/11062b_6a134fc09ea34833a17d295e295ab517f000.jpg/v1/fill/w_1920,h_1080,al_c,q_90,enc_avif,quality_auto/11062b_6a134fc09ea34833a17d295e295ab517f000.jpg)
SP: Utility Function Library
This is the documentation hub for the Shady Practices: Utility Function Library for Unreal Engine 4.
![ShadyPractices_AVI.png](https://static.wixstatic.com/media/9234e2_af445713c7ac4696be63966ce330582c~mv2_d_2160_2160_s_2.png/v1/fill/w_385,h_393,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/ShadyPractices_AVI.png)
![code_god.png](https://static.wixstatic.com/media/9234e2_9b58daadc87e4867ba9ebd6eabd26810~mv2.png/v1/fill/w_320,h_319,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/code_god.png)
Below is a comprehensive list of all of the current functionality offered in the library:
- Check in Front
- Get Furthest Actor of Class
- Get Furthest Instance
- Get Closest Actor of Class
- Get Closest Instance
- Is in Front of Actor?
- Get Distance to Point
- Can See Actor?
- Get Angle Between Actors
- Is Right of Actor?
- Get Random Point On Circle
- Get Random Point on Sphere
- Random Color
- Random Color Opaque
- Random Linear Color
- Random Linear Color Opaque
- Add to Angle
DOCS
- Check in Front -
Checks whether or not an actor is in front of another.
Parameters:
- Source: Vector location of where to begin checking in front of
- Source Forward: The forward vector of the given source point
- Target: The target vector location that you want to determine if it is in front of the source or not
- Max Angle:
- Debug: Whether or not to show debug
![CheckInFront.png](https://static.wixstatic.com/media/9234e2_6db5fceff50d42ae9787cd25ae9d2061~mv2.png/v1/fill/w_203,h_171,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/CheckInFront.png)
- Get Furthest Instance -
Returns the furthest away actor in the given array as well as the distance in cm from that actor to the origin point.
Parameters:
- Origin: Vector location of where you are checking distances from
- Use XY?: If checked, ignores the Z axis distance
- Squared: Check this if the distance returned does not matter and you want higher performance
- Debug: Whether or not to show debug
![GetFurthestInstance.png](https://static.wixstatic.com/media/9234e2_d0b5bda8cb8447cbbdb62e099fb36e12~mv2.png/v1/fill/w_205,h_136,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/GetFurthestInstance.png)
- Get Furthest Actor of Class -
- Get Closest Instance -
Returns the furthest away actor of a given class to a specified point.
Do not use this on tick as it can be very expensive.
Parameters:
- Origin: Vector location of where you are checking distances from
- Use XY?: If checked, ignores the Z axis distance
- Squared: Check this if the distance returned does not matter and you want higher performance
- Debug: Whether or not to show debug
![furthestactorofclass.png](https://static.wixstatic.com/media/9234e2_bc35eec5f18c40c0a3ce42ccdcdde9b4~mv2.png/v1/fill/w_205,h_150,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/furthestactorofclass.png)
Returns the closest actor in the given array as well as the distance in cm from that actor to the origin point.
Parameters:
- Origin: Vector location of where you are checking distances from
- Use XY?: If checked, ignores the Z axis distance
- Squared: Check this if the distance returned does not matter and you want higher performance
- Debug: Whether or not to show debug
![GetClosestActor.png](https://static.wixstatic.com/media/9234e2_46814e5cb11a489fb59305ffc9989704~mv2.png/v1/fill/w_204,h_136,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/GetClosestActor.png)
- Get Closest Actor of Class -
Returns the closest actor of a given class to a specified point.
Do not use this on tick as it can be very expensive.
Parameters:
- Actor Class: The specified class to find an instance of
- Origin: Vector location of where you are checking distances from
- Use XY?: If checked, ignores the Z axis distance
- Squared: Check this if the distance returned does not matter and you want higher performance
- Debug: Whether or not to show debug
![closestactorofclass.png](https://static.wixstatic.com/media/9234e2_8d91d52d7d074ad4a68eb935064be79e~mv2.png/v1/fill/w_205,h_148,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/closestactorofclass.png)
- Is In Front of Actor -
Returns true if Other Actor is in front of Actor, and false if it is not.
Parameters:
- Actor: Vector location of where you are checking distances from
- Other Actor: The other actor that is either in front of or behind Actor
- In Front Angle: The angle in degrees that you want
- Use XY?: If checked, ignores the Z axis distance
- Debug: Whether or not to show debug
![isinfrontofactor.png](https://static.wixstatic.com/media/9234e2_29e5323033bb4f348db2e14f8eb39386~mv2.png/v1/fill/w_205,h_141,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/isinfrontofactor.png)
- Get Distance to Point -
Returns the distance between two vector locations in cm.
Parameters:
- Source: Vector location start
- Target: Vector location end
- Use XY?: If checked, ignores the Z axis distance
- Distance Squared?: Returns the distance between points squared if true (better for performance)
- Debug: Whether or not to show debug
- Debug Draw Duration: The duration in seconds that debug is drawn for
![getdistancetopoint.png](https://static.wixstatic.com/media/9234e2_4b45edf366374e24be49dc7b0e661fa3~mv2.png/v1/fill/w_205,h_183,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/getdistancetopoint.png)
- Can See Actor -
Returns true if the Target actor is visible from Eye Location, false if it is not.
Pass an empty array into Actors to Ignore if you do not want to ignore any actors blocking visibility.
Parameters:
- Eye Location: Vector location of the "eyes"
- Target: The actor you want to see from Eye Location
- Actors to Ignore: An array of actors to ignore
- Debug: Whether or not to show debug
![canseeactor.png](https://static.wixstatic.com/media/9234e2_a69d9351300e4580a661d4086ada36bd~mv2.png/v1/fill/w_205,h_136,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/canseeactor.png)
- Get Angle Between Actors -
Returns the angle between two actors in degrees or radians. Compares using their forward vectors.
Parameters:
- Actor: Actor A
- Other Actor: Actor B
- Degrees?: An array of actors to ignore
- Debug: Whether or not to show debug
![getanglebetweenactors.png](https://static.wixstatic.com/media/9234e2_ca2fc6494bfe49cbb9ac7dabd7adc8bb~mv2.png/v1/fill/w_204,h_129,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/getanglebetweenactors.png)
- Is Right of Actor? -
Returns true if Other Actor is on the right side of Actor. Uses Actor's forward vector.
Parameters:
- Actor: Actor A
- Other Actor: Actor B
![isrightofactor.png](https://static.wixstatic.com/media/9234e2_d169322bf3c74e25bdd6181435a8e39b~mv2.png/v1/fill/w_204,h_66,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/isrightofactor.png)
- Get Random Point on Circle -
Returns a random location as a vector that lies on a specified circle.
Parameters:
- Origin: The location of the center of the circle
- Radius: The half-width of the circle in cm
- Y Axis: The Y-Axis of the circle in vector form
- Z Axis: The Z-Axis of the circle in vector form
- Debug: Whether or not to show debug
![randompointoncircle.png](https://static.wixstatic.com/media/9234e2_3285762ee22c4516b216bafc004d0fd0~mv2.png/v1/fill/w_205,h_166,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/randompointoncircle.png)
- Get Random Point on Sphere -
Returns a random location as a vector that lies on the surface of a specified sphere.
Parameters:
- Origin: The location of the center of the sphere
- Radius: The half-width of the sphere in cm
- Debug: Whether or not to show debug
![randompointonsphere.png](https://static.wixstatic.com/media/9234e2_f93792c1391c48279cab03ba64a7073b~mv2.png/v1/fill/w_205,h_101,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/randompointonsphere.png)
- Random Color -
![randomcolor.png](https://static.wixstatic.com/media/9234e2_6e9084516ba844dc989eb6ef511cf063~mv2.png/v1/fill/w_186,h_83,al_c,lg_1,q_85,enc_avif,quality_auto/randomcolor.png)
Returns a random RGB color with a random Alpha value between 50 and 255 to ensure visibility.
Parameters:
Returns a random RGB color with an Alpha value of 255.
Parameters:
- Random Color Opaque -
![randomcoloropaque.png](https://static.wixstatic.com/media/9234e2_c5dc13c884374e9aadb514298eeb795e~mv2.png/v1/fill/w_205,h_68,al_c,lg_1,q_85,enc_avif,quality_auto/randomcoloropaque.png)
- Random Linear Color -
Returns a random RGB linear color with a random Alpha value between 1 and 0.
Parameters:
![randomlcolor.png](https://static.wixstatic.com/media/9234e2_94364322acb8436eb00c655dba375791~mv2.png/v1/fill/w_189,h_77,al_c,lg_1,q_85,enc_avif,quality_auto/randomlcolor.png)
- Random Linear Color Opaque -
Returns a random RGB linear color with an Alpha value of 1.
Parameters:
![randomlcoloropaque.png](https://static.wixstatic.com/media/9234e2_91d8aa9e1b264eaca6d5c6d08c458fb4~mv2.png/v1/fill/w_203,h_64,al_c,lg_1,q_85,enc_avif,quality_auto/randomlcoloropaque.png)
- Add to Angle -
Adds two angles together wrapping around between 180 and -180 degrees.
Parameters:
- Angle: The initial angle to add to
- New Degrees: The amount you want to add to the angle in degrees
- Degrees: If checked will return the result in degrees, if unchecked the result will be in radians
![addtoangle.png](https://static.wixstatic.com/media/9234e2_e94ef075adff4f8e955069bfd1c0a72a~mv2.png/v1/fill/w_205,h_106,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/addtoangle.png)
Questions or Concerns? Email me us at shadypracticestudios@gmail.com