Skip to content

Instantly share code, notes, and snippets.

Keith Maggio UtMan88

Block or report user

Report or block UtMan88

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
UtMan88 / ArcDetect.cs
Created Nov 10, 2019
Create an array of points to be used as turrets, and detect if a point is within a certain angle range.
View ArcDetect.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArcDetect : MonoBehaviour
public class Turret
UtMan88 / AngleLerp.cs
Last active Mar 19, 2019
Originally posted by BakonGuy at Unity Answers:, this script helps lerp around angles that potentially pass into the negatives, which would cause objects to spin rapidly.
View AngleLerp.cs
//Properly Lerp between two angles
Vector3 AngleLerp(Vector3 StartAngle, Vector3 FinishAngle, float t)
float xLerp = Mathf.LerpAngle(StartAngle.x, FinishAngle.x, t);
float yLerp = Mathf.LerpAngle(StartAngle.y, FinishAngle.y, t);
float zLerp = Mathf.LerpAngle(StartAngle.z, FinishAngle.z, t);
Vector3 Lerped = new Vector3(xLerp, yLerp, zLerp);
return Lerped;
UtMan88 / SetActiveOnEnable.cs
Created Dec 19, 2018
When the object in the scene becomes enabled, all objects in "observedObjects" will become Enabled/Disabled based on their SetActiveOnEnable flag. Handy for turning things on/off when starting a scene.
View SetActiveOnEnable.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SetActiveOnEnable : MonoBehaviour {
public class ObservedObjects
public GameObject gameObject;
UtMan88 / Simple2DSteer.cs
Created Oct 9, 2017
Simple 2D Steering Algorithm for Unity.
View Simple2DSteer.cs
public class SimpleSteerUtility
// This is more of an example to show how the interface functions can be used in a very simple manner.
// Or, this can be your one-stop shop for a single function call in your Update function.
public static void SimpleSteer(ref Quaternion rotation, // ex: transform.rotation
Vector3 dir, // target - position, normalized
Vector3 up, // ex: transform.up
ref Vector3 velocity, // should be stored in your monobehaviour
ref Vector3 position, // ex: transform.position
float rotationSpeed,
UtMan88 / Steering.cpp
Created Sep 26, 2017
ArduBoy Mock-Steering (Seek) Algorithm
View Steering.cpp
struct FPoint {
float x; /**< The X coordinate of the point */
float y; /**< The Y coordinate of the point */
FPoint steer(const FPoint& target, const FPoint& pos, const FPoint& curForward) {
// Direction to target
FPoint dir;
dir.x = target.x - pos.x;
dir.y = target.y - pos.y;
View GizmoIcon.cs
using UnityEngine;
using System.Collections;
/// <summary>
/// This was just a quick-and-dirty tool when inside the Unity Editor.
/// Need an Icon on something? Throw this on it, assign a texture (via URI string), done.
/// </summary>
public class GizmoIcon : MonoBehaviour {
public string IconFile;
UtMan88 / CloudGenerator.cs
Last active Feb 15, 2020
Unity script that generates random "clouds" (or whatever you want the prefab to be) along an X-Z plane using PerlinNoise.
View CloudGenerator.cs
using UnityEngine;
using System.Collections;
/// <summary>
/// Generates random "clouds" (or whatever you want the prefab to be) along an X-Z plane
/// using PerlinNoise.
/// </summary>
public class CloudGenerator : MonoBehaviour {
/// <summary>
You can’t perform that action at this time.