Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
/// <summary>
/// Responsive Camera Scaler
/// </summary>
public class CameraAspectRatioScaler : MonoBehaviour {
/// <summary>
/// Reference Resolution like 1920x1080
/// </summary>
@anujraghav
anujraghav / MathParabola.cs
Created February 26, 2019 01:53 — forked from ditzel/MathParabola.cs
A simple Math class to calculate a point in 2D or 3D space lying on a parabola. And a more complex parabola controller that you can put on an object.
using UnityEngine;
using System;
public class MathParabola
{
public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
Func<float, float> f = x => -4 * height * x * x + 4 * height * x;
@anujraghav
anujraghav / Platform.cs
Created February 26, 2019 01:52 — forked from ditzel/Platform.cs
Moving Platform
using UnityEngine;
/*
* Moving Platform
*
* 1. Attach WayPointPath to an empty game object
* 2. Create empty game object children (these will be handled as waypoints)
* 3. Attach Platform component to a game object and assign the WayPointPath
*
*
**/
@anujraghav
anujraghav / Paintable.cs
Created February 26, 2019 01:52 — forked from ditzel/Paintable.cs
Drawing Canvas
using System.Collections;
using System.IO;
using UnityEngine;
public class Paintable : MonoBehaviour {
public GameObject Brush;
public float BrushSize = 0.1f;
public RenderTexture RTexture;
@anujraghav
anujraghav / HappyCube.cs
Created February 25, 2019 11:25 — forked from ditzel/HappyCube.cs
Mesh from Code
using UnityEngine;
public class HappyCube : MonoBehaviour {
MeshFilter mFilter;
Mesh Mesh;
public float UpDownFactor = 0.1f;
public float UpDownSpeed = 6f;
public float LeftFactor = 0.3f;
@anujraghav
anujraghav / KdTree.cs
Created February 25, 2019 11:19 — forked from ditzel/KdTree.cs
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;